Class: CoffeeBreak::Beans

Inherits:
Object
  • Object
show all
Defined in:
lib/beans.rb

Constant Summary collapse

@@all =

Stores every instance of Beans and anything collected from scrape methods will display in CLI.

[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, label, price, link, details = nil) ⇒ Beans

Returns a new instance of Beans.



13
14
15
16
17
18
19
20
# File 'lib/beans.rb', line 13

def initialize(name, label, price, link, details=nil) 
    @name = name
    @label = label 
    @price = price
    @details = details
    @link = link
    @@all << self 
end

Instance Attribute Details

#detailsObject

Display collection of coffee with corresponding attributes



7
8
9
# File 'lib/beans.rb', line 7

def details
  @details
end

#labelObject

Display collection of coffee with corresponding attributes



7
8
9
# File 'lib/beans.rb', line 7

def label
  @label
end

Display collection of coffee with corresponding attributes



7
8
9
# File 'lib/beans.rb', line 7

def link
  @link
end

#nameObject

Display collection of coffee with corresponding attributes



7
8
9
# File 'lib/beans.rb', line 7

def name
  @name
end

#priceObject

Display collection of coffee with corresponding attributes



7
8
9
# File 'lib/beans.rb', line 7

def price
  @price
end

Class Method Details

.allObject



22
23
24
# File 'lib/beans.rb', line 22

def self.all
    @@all
end