Module: DTK::DSL::FileGenerator::ContentInput::Mixin
Overview
Mixin for tags and id_handle object attributes
Instance Attribute Summary collapse
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #add_tags!(new_tags) ⇒ Object
- #add_tags?(new_tags) ⇒ Boolean
- #add_tags_to_obj?(obj, new_tags) ⇒ Boolean
- #id_handle ⇒ Object
- #initialize_tags_and_id_handle! ⇒ Object
- #matches_tag_type?(tag_type) ⇒ Boolean
- #obj_has_tag_type?(obj, tag_type) ⇒ Boolean
- #set_id_handle(model_object) ⇒ Object
Instance Attribute Details
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
22 23 24 |
# File 'lib/dsl/file_generator/content_input/mixin.rb', line 22 def end |
Instance Method Details
#add_tags!(new_tags) ⇒ Object
36 37 38 39 |
# File 'lib/dsl/file_generator/content_input/mixin.rb', line 36 def () Tag.(, ) self end |
#add_tags?(new_tags) ⇒ Boolean
41 42 43 |
# File 'lib/dsl/file_generator/content_input/mixin.rb', line 41 def () () unless .nil? or .empty? end |
#add_tags_to_obj?(obj, new_tags) ⇒ Boolean
49 50 51 52 |
# File 'lib/dsl/file_generator/content_input/mixin.rb', line 49 def (obj, ) obj.() if obj.respond_to?(:add_tags!) obj end |
#id_handle ⇒ Object
32 33 34 |
# File 'lib/dsl/file_generator/content_input/mixin.rb', line 32 def id_handle @id_handle || raise(Error,"@id_handle is not set") end |
#initialize_tags_and_id_handle! ⇒ Object
23 24 25 26 |
# File 'lib/dsl/file_generator/content_input/mixin.rb', line 23 def = [] @id_handle = nil end |
#matches_tag_type?(tag_type) ⇒ Boolean
45 46 47 |
# File 'lib/dsl/file_generator/content_input/mixin.rb', line 45 def matches_tag_type?(tag_type) !! .find { |tag| Tag.matches_tag_type?(tag_type, tag) } end |
#obj_has_tag_type?(obj, tag_type) ⇒ Boolean
54 55 56 57 58 59 60 61 |
# File 'lib/dsl/file_generator/content_input/mixin.rb', line 54 def obj_has_tag_type?(obj, tag_type) if obj.respond_to?(:matches_tag_type?) obj.matches_tag_type?(tag_type) else # vacuously succeeds true end end |
#set_id_handle(model_object) ⇒ Object
28 29 30 |
# File 'lib/dsl/file_generator/content_input/mixin.rb', line 28 def set_id_handle(model_object) @id_handle = model_object.id_handle end |