Module: Radiant::Taggable::ClassMethods

Defined in:
lib/radiant/taggable.rb

Instance Method Summary collapse

Instance Method Details

#desc(text) ⇒ Object



54
55
56
# File 'lib/radiant/taggable.rb', line 54

def desc(text)
  Radiant::Taggable.last_description = RedCloth.new(Util.strip_leading_whitespace(text)).to_html
end

#inherited(subclass) ⇒ Object



45
46
47
48
# File 'lib/radiant/taggable.rb', line 45

def inherited(subclass)
  subclass.tag_descriptions.reverse_merge! self.tag_descriptions
  super
end

#tag(name, &block) ⇒ Object



58
59
60
61
62
# File 'lib/radiant/taggable.rb', line 58

def tag(name, &block)
  self.tag_descriptions[name] = Radiant::Taggable.last_description if Radiant::Taggable.last_description
  Radiant::Taggable.last_description = nil
  define_method("tag:#{name}", &block)
end

#tag_descriptions(hash = nil) ⇒ Object



50
51
52
# File 'lib/radiant/taggable.rb', line 50

def tag_descriptions(hash = nil)
  Radiant::Taggable.tag_descriptions[self.name] ||= (hash ||{})
end

#tagsObject



64
65
66
# File 'lib/radiant/taggable.rb', line 64

def tags
  Util.tags_in_array(self.instance_methods)
end