Class: BreweryDB::Collection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/brewery_db/collection.rb

Direct Known Subclasses

PaginatedCollection

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Collection

Returns a new instance of Collection.



8
9
10
# File 'lib/brewery_db/collection.rb', line 8

def initialize(response)
  self.response = response
end

Instance Attribute Details

#sizeObject (readonly) Also known as: length

Returns the value of attribute size.



5
6
7
# File 'lib/brewery_db/collection.rb', line 5

def size
  @size
end

Instance Method Details

#eachObject



12
13
14
15
# File 'lib/brewery_db/collection.rb', line 12

def each
  return to_enum unless block_given?
  @collection.each { |element| yield(element) }
end