Module: NamedArray

Defined in:
lib/scout/entity/named_array.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/scout/entity/named_array.rb', line 6

def [](key)
  pos = NamedArray.identify_name(@fields, key)
  return nil if pos.nil?
  v = super(pos)
  field = @fields && Integer === key && ! @fields.include?(key) ? @fields[key] : key
  Entity.prepare_entity(v, field)
end