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)


129
130
131
# File 'lib/dsl/file_parser.rb', line 129

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

Instance Method Details

#+(output_obj) ⇒ Object



116
117
118
119
120
121
122
123
124
125
126
# File 'lib/dsl/file_parser.rb', line 116

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



108
109
110
111
112
113
114
# File 'lib/dsl/file_parser.rb', line 108

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