module DTK::DSL::Template::Parsing::ClassMixin

Public Instance Methods

elements_collection_type() click to toggle source

Indicates whether collection of elements to parse is a hash or array This can be overwritten

# File lib/dsl/template/parsing/class_mixin.rb, line 29
def elements_collection_type
  nil
end
empty_input_hash() click to toggle source
# File lib/dsl/template/parsing/class_mixin.rb, line 53
def empty_input_hash
  FileParser::Input::Hash.new(self)
end
file_parser_output_array() click to toggle source
# 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() click to toggle source
# 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 = {}) click to toggle source

opts can have keys

:index
# 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) click to toggle source

Main template-specific parse call; Concrete classes overwrite this

# File lib/dsl/template/parsing/class_mixin.rb, line 23
def parse_elements(_input_elements, _parent_info)
  raise Error::NoMethodForConcreteClass.new(self)
end

Private Instance Methods

input_array?(input) click to toggle source
# File lib/dsl/template/parsing/class_mixin.rb, line 63
def input_array?(input)
  input.kind_of?(FileParser::Input::Array)
end
input_hash?(input) click to toggle source
# File lib/dsl/template/parsing/class_mixin.rb, line 59
def input_hash?(input)
  input.kind_of?(FileParser::Input::Hash)
end