Module: DomainDriven::Collection

Defined in:
lib/domain_driven/entity.rb

Instance Method Summary collapse

Instance Method Details

#eachObject



48
49
50
51
52
# File 'lib/domain_driven/entity.rb', line 48

def each
  _data.each do |_item|
    yield self._real_class.wrap(_item) 
  end
end

#include?(other) ⇒ Boolean



60
61
62
63
64
65
66
# File 'lib/domain_driven/entity.rb', line 60

def include?(other)
  if other.respond_to?(:_data)
    _data.include?(other._data)
  else
    _data.include?(other)
  end
end

#to_aObject



54
55
56
57
58
# File 'lib/domain_driven/entity.rb', line 54

def to_a
  _data.inject([]) do |array, _item|
    array << self._real_class.wrap(_item)
  end
end