Module: DTK::DSL::Template::Parsing::ClassMixin
- Included in:
- DTK::DSL::Template
- Defined in:
- lib/dsl/template/parsing/class_mixin.rb
Instance Method Summary collapse
-
#elements_collection_type ⇒ Object
Indicates whether collection of elements to parse is a hash or array This can be overwritten.
- #file_parser_output_array ⇒ Object
- #file_parser_output_hash ⇒ Object
-
#parse_element(input, parent_info, opts = {}) ⇒ Object
opts can have keys :index.
-
#parse_elements(_input_elements, _parent_info) ⇒ Object
Main template-specific parse call; Concrete classes overwrite this.
Instance Method Details
#elements_collection_type ⇒ Object
Indicates whether collection of elements to parse is a hash or array This can be overwritten
29 30 31 |
# File 'lib/dsl/template/parsing/class_mixin.rb', line 29 def elements_collection_type nil end |
#file_parser_output_array ⇒ Object
33 34 35 |
# File 'lib/dsl/template/parsing/class_mixin.rb', line 33 def file_parser_output_array FileParser::Output.create(:output_type => :array) end |
#file_parser_output_hash ⇒ Object
37 38 39 |
# File 'lib/dsl/template/parsing/class_mixin.rb', line 37 def file_parser_output_hash FileParser::Output.create(:output_type => :hash) end |
#parse_element(input, parent_info, opts = {}) ⇒ Object
opts can have keys
:index
43 44 45 46 47 48 49 50 51 |
# File 'lib/dsl/template/parsing/class_mixin.rb', line 43 def parse_element(input, parent_info, opts = {}) if input.nil? nil else file_obj = parent_info.parent.file_obj parent_key = ParentKey.parent_key(parent_info, opts[:index]) create_for_parsing(input, :file_obj => file_obj, :parent_key => parent_key).parse end end |
#parse_elements(_input_elements, _parent_info) ⇒ Object
Main template-specific parse call; Concrete classes overwrite this
23 24 25 |
# File 'lib/dsl/template/parsing/class_mixin.rb', line 23 def parse_elements(_input_elements, _parent_info) raise Error::NoMethodForConcreteClass.new(self) end |