Class: Cubbyhole::Collection

Inherits:
Array
  • Object
show all
Defined in:
lib/cubbyhole/collection.rb

Instance Method Summary collapse

Instance Method Details

#all(atts = nil) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/cubbyhole/collection.rb', line 20

def all(atts = nil)
  if atts
    Collection.new(where(atts))
  else
    self
  end
end

#first(atts = nil) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/cubbyhole/collection.rb', line 12

def first(atts = nil)
  if atts
    all(atts).first
  else
    super()
  end
end

#last(atts = nil) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/cubbyhole/collection.rb', line 4

def last(atts = nil)
  if atts
    all(atts).last
  else
    super()
  end
end