Class: OnTapIbc::Beer
- Inherits:
-
Object
- Object
- OnTapIbc::Beer
- Defined in:
- lib/on_tap_ibc/beer.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#abv ⇒ Object
Returns the value of attribute abv.
-
#addl1 ⇒ Object
Returns the value of attribute addl1.
-
#long_desc ⇒ Object
Returns the value of attribute long_desc.
-
#name ⇒ Object
Returns the value of attribute name.
-
#short_desc ⇒ Object
Returns the value of attribute short_desc.
-
#style ⇒ Object
Returns the value of attribute style.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(beer_hash) ⇒ Beer
constructor
A new instance of Beer.
Constructor Details
#initialize(beer_hash) ⇒ Beer
Returns a new instance of Beer.
6 7 8 9 |
# File 'lib/on_tap_ibc/beer.rb', line 6 def initialize(beer_hash) beer_hash.each {|key, value| self.send(("#{key}="), value)} @@all << self end |
Instance Attribute Details
#abv ⇒ Object
Returns the value of attribute abv.
2 3 4 |
# File 'lib/on_tap_ibc/beer.rb', line 2 def abv @abv end |
#addl1 ⇒ Object
Returns the value of attribute addl1.
2 3 4 |
# File 'lib/on_tap_ibc/beer.rb', line 2 def addl1 @addl1 end |
#long_desc ⇒ Object
Returns the value of attribute long_desc.
2 3 4 |
# File 'lib/on_tap_ibc/beer.rb', line 2 def long_desc @long_desc end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/on_tap_ibc/beer.rb', line 2 def name @name end |
#short_desc ⇒ Object
Returns the value of attribute short_desc.
2 3 4 |
# File 'lib/on_tap_ibc/beer.rb', line 2 def short_desc @short_desc end |
#style ⇒ Object
Returns the value of attribute style.
2 3 4 |
# File 'lib/on_tap_ibc/beer.rb', line 2 def style @style end |
Class Method Details
.all ⇒ Object
28 29 30 |
# File 'lib/on_tap_ibc/beer.rb', line 28 def self.all @@all end |
.assign_beer(selected_tap) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/on_tap_ibc/beer.rb', line 15 def self.assign_beer(selected_tap) @beer_detail_hash = OnTapIbc::Scraper.beer_details.find{|k, v| k == selected_tap.name.upcase } if @beer_detail_hash != nil @beer_detail_hash[1].each do |attribute, data| selected_tap.send(("#{attribute}="), data) end end end |
.create_from_menu(current_beers) ⇒ Object
11 12 13 |
# File 'lib/on_tap_ibc/beer.rb', line 11 def self.(current_beers) current_beers.each {|beer| self.new(beer)} end |