class Mother::Collection
Attributes
data[R]
mother[R]
Public Class Methods
new(mother, argument)
click to toggle source
# File lib/mother/collection.rb, line 7 def initialize(mother, argument) mother.argument_failure! unless argument.is_a?(Array) @mother = mother @data = argument end
Public Instance Methods
[](index)
click to toggle source
# File lib/mother/collection.rb, line 22 def [](index) mother.create data[index] end
each(&block)
click to toggle source
# File lib/mother/collection.rb, line 26 def each(&block) data.map{ |i| mother.create i }.each(&block) end
first()
click to toggle source
# File lib/mother/collection.rb, line 14 def first mother.create data.first end
last()
click to toggle source
# File lib/mother/collection.rb, line 18 def last mother.create data.last end