module Docks::Tags
Public Class Methods
<<(tag)
click to toggle source
# File lib/docks/tags.rb, line 36 def self.<<(tag) register(tag) end
base_tag_name(tag)
click to toggle source
# File lib/docks/tags.rb, line 7 def self.base_tag_name(tag) tag = tag.instance.name if tag.instance_of?(Class) tag = tag.name if tag.kind_of?(Base) tag = tag.to_sym found = @synonyms[tag] return found if found end
has_tag?(tag)
click to toggle source
# File lib/docks/tags.rb, line 67 def self.has_tag?(tag) !tag_for(tag).nil? end
register(tag)
click to toggle source
# File lib/docks/tags.rb, line 20 def self.register(tag) tag = tag.instance tag.setup_post_processors return false if tag.name.nil? tag_name = tag.name.to_sym @tags[tag_name] = tag [tag_name, tag.synonyms].flatten.each do |synonym| @synonyms[synonym.to_sym] = tag_name @synonyms[synonym.to_s.pluralize.to_sym] = tag_name if tag.multiple_allowed? end true end
tag_for(tag)
click to toggle source
# File lib/docks/tags.rb, line 3 def self.tag_for(tag) @tags[base_tag_name(tag)] end
Private Class Methods
clean()
click to toggle source
# File lib/docks/tags.rb, line 95 def self.clean @tags = {} @synonyms = {} @bundled_tags = nil end