Class: Docxtor::RunningElementsBuilder
- Inherits:
-
Object
- Object
- Docxtor::RunningElementsBuilder
- Defined in:
- lib/docxtor/running_elements_builder.rb
Instance Attribute Summary collapse
-
#elements ⇒ Object
Returns the value of attribute elements.
Instance Method Summary collapse
-
#initialize(&block) ⇒ RunningElementsBuilder
constructor
A new instance of RunningElementsBuilder.
- #method_missing(method_name, *args) ⇒ Object
Constructor Details
#initialize(&block) ⇒ RunningElementsBuilder
Returns a new instance of RunningElementsBuilder.
13 14 15 16 |
# File 'lib/docxtor/running_elements_builder.rb', line 13 def initialize &block @elements = [] instance_eval &block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/docxtor/running_elements_builder.rb', line 5 def method_missing method_name, *args num = 0 if [:header, :footer].include? method_name num += 1 @elements << RunningElement.new(method_name, num, *args) end end |
Instance Attribute Details
#elements ⇒ Object
Returns the value of attribute elements.
3 4 5 |
# File 'lib/docxtor/running_elements_builder.rb', line 3 def elements @elements end |