Module: XamplExample::DescriptionAsChild
- Included in:
- Thing
- Defined in:
- lib/xamplr/handwritten/example.rb,
lib/xamplr/handwritten/hand-example.rb
Instance Attribute Summary collapse
-
#description_child ⇒ Object
Returns the value of attribute description_child.
Instance Method Summary collapse
- #add_description(description) ⇒ Object
- #init_description_as_child ⇒ Object
- #new_description {|description| ... } ⇒ Object
- #remove_description(description) ⇒ Object
Instance Attribute Details
#description_child ⇒ Object
Returns the value of attribute description_child.
85 86 87 |
# File 'lib/xamplr/handwritten/example.rb', line 85 def description_child @description_child end |
Instance Method Details
#add_description(description) ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/xamplr/handwritten/example.rb', line 91 def add_description(description) @children << description @description_child << description description.add_parent(self) changed return description end |
#init_description_as_child ⇒ Object
87 88 89 |
# File 'lib/xamplr/handwritten/example.rb', line 87 def init_description_as_child @description_child = [] end |
#new_description {|description| ... } ⇒ Object
99 100 101 102 103 |
# File 'lib/xamplr/handwritten/example.rb', line 99 def new_description description = Description.new yield(description) if block_given? return add_description(description) end |
#remove_description(description) ⇒ Object
105 106 107 108 |
# File 'lib/xamplr/handwritten/example.rb', line 105 def remove_description(description) @description_child.delete(description) @children.delete(description) end |