Class: Shoe
- Inherits:
-
Object
- Object
- Shoe
- Defined in:
- lib/shoe.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#brand ⇒ Object
Returns the value of attribute brand.
-
#colorway ⇒ Object
Returns the value of attribute colorway.
-
#condition ⇒ Object
Returns the value of attribute condition.
-
#price ⇒ Object
Returns the value of attribute price.
-
#productid ⇒ Object
Returns the value of attribute productid.
-
#shoe_href ⇒ Object
Returns the value of attribute shoe_href.
-
#shoe_name ⇒ Object
Returns the value of attribute shoe_name.
-
#sizes_available ⇒ Object
Returns the value of attribute sizes_available.
-
#year ⇒ Object
Returns the value of attribute year.
Class Method Summary collapse
Instance Method Summary collapse
- #add_attributes(hash) ⇒ Object
-
#initialize(hash) ⇒ Shoe
constructor
A new instance of Shoe.
Constructor Details
#initialize(hash) ⇒ Shoe
Returns a new instance of Shoe.
8 9 10 11 12 13 |
# File 'lib/shoe.rb', line 8 def initialize(hash) hash.each do |key, value| send("#{key}=", value) end @@all.unshift(self) end |
Instance Attribute Details
#brand ⇒ Object
Returns the value of attribute brand.
4 5 6 |
# File 'lib/shoe.rb', line 4 def brand @brand end |
#colorway ⇒ Object
Returns the value of attribute colorway.
4 5 6 |
# File 'lib/shoe.rb', line 4 def colorway @colorway end |
#condition ⇒ Object
Returns the value of attribute condition.
4 5 6 |
# File 'lib/shoe.rb', line 4 def condition @condition end |
#price ⇒ Object
Returns the value of attribute price.
4 5 6 |
# File 'lib/shoe.rb', line 4 def price @price end |
#productid ⇒ Object
Returns the value of attribute productid.
4 5 6 |
# File 'lib/shoe.rb', line 4 def productid @productid end |
#shoe_href ⇒ Object
Returns the value of attribute shoe_href.
4 5 6 |
# File 'lib/shoe.rb', line 4 def shoe_href @shoe_href end |
#shoe_name ⇒ Object
Returns the value of attribute shoe_name.
4 5 6 |
# File 'lib/shoe.rb', line 4 def shoe_name @shoe_name end |
#sizes_available ⇒ Object
Returns the value of attribute sizes_available.
4 5 6 |
# File 'lib/shoe.rb', line 4 def sizes_available @sizes_available end |
#year ⇒ Object
Returns the value of attribute year.
4 5 6 |
# File 'lib/shoe.rb', line 4 def year @year end |
Class Method Details
.all ⇒ Object
22 23 24 |
# File 'lib/shoe.rb', line 22 def self.all @@all end |
.create_from_collection(array_of_hash) ⇒ Object
16 17 18 19 20 |
# File 'lib/shoe.rb', line 16 def self.create_from_collection(array_of_hash) array_of_hash.each do |hash| self.new(hash) end end |
Instance Method Details
#add_attributes(hash) ⇒ Object
26 27 28 29 30 |
# File 'lib/shoe.rb', line 26 def add_attributes(hash) hash.each do |key, value| send("#{key}=", value) end end |