Class: Sequence::SequenceTemplate::Section
- Inherits:
-
UnaryElement
- Object
- UnaryElement
- Sequence::SequenceTemplate::Section
- Defined in:
- lib/lucid/sequence/sequence_template.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
Attributes inherited from UnaryElement
Instance Method Summary collapse
- #add_child(child) ⇒ Object
-
#initialize(name) ⇒ Section
constructor
A new instance of Section.
- #output(context, params) ⇒ Object
- #variables ⇒ Object
Methods inherited from UnaryElement
Constructor Details
#initialize(name) ⇒ Section
Returns a new instance of Section.
64 65 66 67 |
# File 'lib/lucid/sequence/sequence_template.rb', line 64 def initialize(name) super(name) @children = [] end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
62 63 64 |
# File 'lib/lucid/sequence/sequence_template.rb', line 62 def children @children end |
Instance Method Details
#add_child(child) ⇒ Object
69 70 71 |
# File 'lib/lucid/sequence/sequence_template.rb', line 69 def add_child(child) children << child end |
#output(context, params) ⇒ Object
87 88 89 90 |
# File 'lib/lucid/sequence/sequence_template.rb', line 87 def output(context, params) msg = "Method Section.#{__method__} must be implemented in subclass." raise NotImplementedError, msg end |
#variables ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/lucid/sequence/sequence_template.rb', line 73 def variables section_variables = children.each_with_object([]) do |child, result| case child when Placeholder result << child.name when Section result.concat(child.variables) else # noop end end return section_variables.flatten.uniq end |