Class: Shoe

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#brandObject

Returns the value of attribute brand.



4
5
6
# File 'lib/shoe.rb', line 4

def brand
  @brand
end

#colorwayObject

Returns the value of attribute colorway.



4
5
6
# File 'lib/shoe.rb', line 4

def colorway
  @colorway
end

#conditionObject

Returns the value of attribute condition.



4
5
6
# File 'lib/shoe.rb', line 4

def condition
  @condition
end

#priceObject

Returns the value of attribute price.



4
5
6
# File 'lib/shoe.rb', line 4

def price
  @price
end

#productidObject

Returns the value of attribute productid.



4
5
6
# File 'lib/shoe.rb', line 4

def productid
  @productid
end

#shoe_hrefObject

Returns the value of attribute shoe_href.



4
5
6
# File 'lib/shoe.rb', line 4

def shoe_href
  @shoe_href
end

#shoe_nameObject

Returns the value of attribute shoe_name.



4
5
6
# File 'lib/shoe.rb', line 4

def shoe_name
  @shoe_name
end

#sizes_availableObject

Returns the value of attribute sizes_available.



4
5
6
# File 'lib/shoe.rb', line 4

def sizes_available
  @sizes_available
end

#yearObject

Returns the value of attribute year.



4
5
6
# File 'lib/shoe.rb', line 4

def year
  @year
end

Class Method Details

.allObject



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