Class: Vop::Entities

Inherits:
Array
  • Object
show all
Defined in:
lib/vop/objects/entities.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/vop/objects/entities.rb', line 5

def [](key)
  # if key.is_a? Numeric
  #   super(key)
  # else
    $logger.debug "accessing entity with key '#{key}'"
    found = select { |x| x.id == key }.first
    if found
      found
    else
      raise "no element with key '#{key}'"
    end
  # end
end