Module: Ecoportal::API::Common::Content::CollectionModel::Model::Lookup

Extended by:
Includer
Defined in:
lib/ecoportal/api/common/content/collection_model/model/lookup.rb

Instance Method Summary collapse

Methods included from Includer

include_missing

Instance Method Details

#[](value) ⇒ Object

Get an element usign the key.



24
25
26
# File 'lib/ecoportal/api/common/content/collection_model/model/lookup.rb', line 24

def [](value)
  items_by_key[get_key(value)]
end

#include?(value) ⇒ Boolean

Checks if an element exists in the collection



31
32
33
# File 'lib/ecoportal/api/common/content/collection_model/model/lookup.rb', line 31

def include?(value)
  items_by_key.key?(get_key(value))
end

#values_at(*keys) ⇒ Array<Object>



36
37
38
# File 'lib/ecoportal/api/common/content/collection_model/model/lookup.rb', line 36

def values_at(*keys)
  keys.map {|key| self[key]}
end