Module: Fortitude::Tags::TagStore
- Included in:
- Doctypes::Base, Doctypes::Html4TagsFrameset, Doctypes::Html4TagsStrict, Doctypes::Html4TagsTransitional
- Defined in:
- lib/fortitude/tags/tag_store.rb
Instance Method Summary collapse
- #delegate_tag_stores ⇒ Object
- #modify_tag(name) {|new_tag| ... } ⇒ Object
- #tag(name, options = nil) ⇒ Object
- #tag_names ⇒ Object
- #tags ⇒ Object
- #tags_added!(tags) ⇒ Object
- #tags_changed!(tags) ⇒ Object
Instance Method Details
#delegate_tag_stores ⇒ Object
52 53 54 |
# File 'lib/fortitude/tags/tag_store.rb', line 52 def delegate_tag_stores [ ] end |
#modify_tag(name) {|new_tag| ... } ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fortitude/tags/tag_store.rb', line 17 def modify_tag(name) name = Fortitude::Tags::Tag.normalize_tag_name(name) existing_tag = [name] unless existing_tag raise Fortitude::Errors::TagNotFound.new(self, name) end new_tag = existing_tag.dup yield new_tag @_tags_by_name ||= { } @_tags_by_name[name] = new_tag ([ new_tag ]) end |
#tag(name, options = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/fortitude/tags/tag_store.rb', line 7 def tag(name, = nil) @_tags_by_name ||= { } name = Fortitude::Tags::Tag.normalize_tag_name(name) tag_object = Fortitude::Tags::Tag.new(name, || { }) @_tags_by_name[name] = tag_object ([ tag_object ]) end |
#tag_names ⇒ Object
40 41 42 |
# File 'lib/fortitude/tags/tag_store.rb', line 40 def tag_names .keys end |
#tags ⇒ Object
33 34 35 36 37 38 |
# File 'lib/fortitude/tags/tag_store.rb', line 33 def out = { } (delegate_tag_stores || [ ]).each { |d| out.merge!(d.) } out.merge!(@_tags_by_name || { }) out end |
#tags_added!(tags) ⇒ Object
44 45 46 |
# File 'lib/fortitude/tags/tag_store.rb', line 44 def () () end |
#tags_changed!(tags) ⇒ Object
48 49 50 |
# File 'lib/fortitude/tags/tag_store.rb', line 48 def () # nothing here end |