Class: DtkCommon::DSL::FileParser::OutputArray

Inherits:
Array
  • Object
show all
Defined in:
lib/dsl/file_parser.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.has_required_keys?(hash_el) ⇒ Boolean

can be overwritten

Returns:

  • (Boolean)


113
114
115
# File 'lib/dsl/file_parser.rb', line 113

def self.has_required_keys?(hash_el)
  (keys_for_row() - hash_el.keys?).nil?
end

Instance Method Details

#+(output_obj) ⇒ Object



100
101
102
103
104
105
106
107
108
109
110
# File 'lib/dsl/file_parser.rb', line 100

def +(output_obj)
  if output_obj.kind_of?(OutputArray)
    super
  elsif output_obj.kind_of?(OutputHash)
    super(OutputArray.new(OutputHash))
  elsif output_obj.nil?
    self
  else
    raise Error.new("Unexpected object type (#{output_obj.class})")
  end
end

#<<(hash_el) ⇒ Object



92
93
94
95
96
97
98
# File 'lib/dsl/file_parser.rb', line 92

def <<(hash_el)
  bad_keys = hash_el.keys - self.class.keys_for_row()
  unless bad_keys.empty?
    raise Error.new("Illegal keys being inserted in OutputArray (#{bad_keys.join(',')})")
  end
  super
end