Module: Fabulator::Template::Taggable::ClassMethods

Defined in:
lib/fabulator/template/taggable.rb

Instance Method Summary collapse

Instance Method Details

#desc(text) ⇒ Object



51
52
53
# File 'lib/fabulator/template/taggable.rb', line 51

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

#inherited(subclass) ⇒ Object



42
43
44
45
# File 'lib/fabulator/template/taggable.rb', line 42

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

#tag(name, &block) ⇒ Object



55
56
57
58
59
# File 'lib/fabulator/template/taggable.rb', line 55

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

#tag_descriptions(hash = nil) ⇒ Object



47
48
49
# File 'lib/fabulator/template/taggable.rb', line 47

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

#tagsObject



61
62
63
# File 'lib/fabulator/template/taggable.rb', line 61

def tags
  Util.tags_in_array(self.instance_methods)
end