Module: DataMapper::Ambition::Collection

Defined in:
lib/dm-ambition/collection.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
# File 'lib/dm-ambition/collection.rb', line 4

def self.included(base)
  base.send(:alias_method, :find,     :detect)
  base.send(:alias_method, :find_all, :select)
end

Instance Method Details

#detect(&block) ⇒ Object

TODO: document this



11
12
13
14
# File 'lib/dm-ambition/collection.rb', line 11

def detect(&block)
  return super if loaded?
  head.detect(&block) || first(query.filter(&block))
end

#reject(&block) ⇒ Object

TODO: document this



24
25
26
# File 'lib/dm-ambition/collection.rb', line 24

def reject(&block)
  filter_collection(:-, block) { super }
end

#select(&block) ⇒ Object

TODO: document this



18
19
20
# File 'lib/dm-ambition/collection.rb', line 18

def select(&block)
  filter_collection(:&, block) { super }
end