Public instance methods
build_machine_tag
(namespace, predicate, value)
Builds a machine tag string given namespace, predicate and value.
[show source]
# File lib/has_machine_tags/tag_methods.rb, line 104 def build_machine_tag(namespace, predicate, value) "#{namespace}:#{predicate}=#{value}" end
machine_tag?
(machine_tag)
Boolean indicating if given tag is a machine tag.
[show source]
# File lib/has_machine_tags/tag_methods.rb, line 114 def machine_tag?(machine_tag) !extract_from_name(machine_tag).nil? end
machine_tags
(name)
Takes a wildcard machine tag and returns matching tags.
[show source]
# File lib/has_machine_tags/tag_methods.rb, line 92 def machine_tags(name) conditions = if (match = match_wildcard_machine_tag(name)) match.map {|k,v| sanitize_sql(["#{k} = ?", v]) }.join(" AND ") else sanitize_sql(["name = ?", name]) end find(:all, :conditions=>conditions) end
split_machine_tag
(machine_tag)
Returns an array of machine tag parts: [namespace, predicate, value]
[show source]
# File lib/has_machine_tags/tag_methods.rb, line 109 def split_machine_tag(machine_tag) extract_from_name(machine_tag) || [] end