Module: Radiant::Taggable::ClassMethods

Defined in:
lib/radiant/taggable.rb

Instance Method Summary collapse

Instance Method Details

#desc(text) ⇒ Object



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

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

#inherited(subclass) ⇒ Object



43
44
45
46
# File 'lib/radiant/taggable.rb', line 43

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

#tag(name, &block) ⇒ Object



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

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



48
49
50
# File 'lib/radiant/taggable.rb', line 48

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

#tagsObject



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

def tags
  Util.tags_in_array(self.instance_methods)
end