Class: StellingBanjos::Banjos
- Inherits:
-
Object
- Object
- StellingBanjos::Banjos
- Defined in:
- lib/stelling_banjos/banjos.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#link ⇒ Object
Returns the value of attribute link.
-
#name ⇒ Object
Returns the value of attribute name.
-
#price ⇒ Object
Returns the value of attribute price.
-
#sold_out ⇒ Object
Returns the value of attribute sold_out.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, price, link, sold_out) ⇒ Banjos
constructor
A new instance of Banjos.
- #sold_out? ⇒ Boolean
Constructor Details
#initialize(name, price, link, sold_out) ⇒ Banjos
Returns a new instance of Banjos.
6 7 8 9 10 11 12 |
# File 'lib/stelling_banjos/banjos.rb', line 6 def initialize(name, price, link, sold_out) @name = name @price = price @link = link @sold_out = sold_out @@all << self end |
Instance Attribute Details
#link ⇒ Object
Returns the value of attribute link.
2 3 4 |
# File 'lib/stelling_banjos/banjos.rb', line 2 def link @link end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/stelling_banjos/banjos.rb', line 2 def name @name end |
#price ⇒ Object
Returns the value of attribute price.
2 3 4 |
# File 'lib/stelling_banjos/banjos.rb', line 2 def price @price end |
#sold_out ⇒ Object
Returns the value of attribute sold_out.
2 3 4 |
# File 'lib/stelling_banjos/banjos.rb', line 2 def sold_out @sold_out end |
Class Method Details
.all ⇒ Object
31 32 33 |
# File 'lib/stelling_banjos/banjos.rb', line 31 def self.all @@all end |
.create_from_catalog(array) ⇒ Object
14 15 16 17 18 |
# File 'lib/stelling_banjos/banjos.rb', line 14 def self.create_from_catalog(array) array.each do |hash| self.new(hash[:name], hash[:price], hash[:link], hash[:sold_out]) end end |
Instance Method Details
#sold_out? ⇒ Boolean
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/stelling_banjos/banjos.rb', line 20 def sold_out? case @sold_out when "Yes" return true when "No" return false else return false end end |