Class: Guitar

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

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(details) ⇒ Guitar

Returns a new instance of Guitar.



6
7
8
9
10
11
# File 'lib/fender_guitar_catalogue/guitar.rb', line 6

def initialize(details)
    details.each do |key, value|
        send("#{key}=", value)
    end
    @@all << self
end

Instance Attribute Details

#modelObject

Returns the value of attribute model.



2
3
4
# File 'lib/fender_guitar_catalogue/guitar.rb', line 2

def model
  @model
end

#priceObject

Returns the value of attribute price.



2
3
4
# File 'lib/fender_guitar_catalogue/guitar.rb', line 2

def price
  @price
end

#urlObject

Returns the value of attribute url.



2
3
4
# File 'lib/fender_guitar_catalogue/guitar.rb', line 2

def url
  @url
end

Class Method Details

.allObject



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

def self.all
    @@all
end

Instance Method Details

#item_descObject



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

def item_desc
    puts "===#{@model.upcase}==="
    Scraper.new.scrape_content(@url)
    puts ""
    puts "~Price (AUD)~"
    puts ""
    puts @price
end