Class: Madden20MarketPrices::Player
- Inherits:
-
Object
- Object
- Madden20MarketPrices::Player
- Defined in:
- lib/madden_20_market_prices/player.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#cost ⇒ Object
Returns the value of attribute cost.
-
#info ⇒ Object
Returns the value of attribute info.
-
#name ⇒ Object
Returns the value of attribute name.
-
#ovr ⇒ Object
Returns the value of attribute ovr.
-
#price_change_percent ⇒ Object
Returns the value of attribute price_change_percent.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name = nil, info = nil, cost = nil, price_change_percent = nil, ovr = nil) ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize(name = nil, info = nil, cost = nil, price_change_percent = nil, ovr = nil) ⇒ Player
Returns a new instance of Player.
7 8 9 10 11 12 13 14 |
# File 'lib/madden_20_market_prices/player.rb', line 7 def initialize(name = nil, info = nil, cost = nil, price_change_percent = nil, ovr = nil) @name = name @info = info @cost = cost @price_change_percent = price_change_percent @ovr = ovr @@all << self end |
Instance Attribute Details
#cost ⇒ Object
Returns the value of attribute cost.
3 4 5 |
# File 'lib/madden_20_market_prices/player.rb', line 3 def cost @cost end |
#info ⇒ Object
Returns the value of attribute info.
3 4 5 |
# File 'lib/madden_20_market_prices/player.rb', line 3 def info @info end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/madden_20_market_prices/player.rb', line 3 def name @name end |
#ovr ⇒ Object
Returns the value of attribute ovr.
3 4 5 |
# File 'lib/madden_20_market_prices/player.rb', line 3 def ovr @ovr end |
#price_change_percent ⇒ Object
Returns the value of attribute price_change_percent.
3 4 5 |
# File 'lib/madden_20_market_prices/player.rb', line 3 def price_change_percent @price_change_percent end |
Class Method Details
.all ⇒ Object
26 27 28 |
# File 'lib/madden_20_market_prices/player.rb', line 26 def self.all @@all end |
.find(index) ⇒ Object
30 31 32 |
# File 'lib/madden_20_market_prices/player.rb', line 30 def self.find(index) self.all[index - 1] end |
.new_from_prices_page(player) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/madden_20_market_prices/player.rb', line 16 def self.new_from_prices_page(player) self.new( player.css("div.list-info-player__player-name").text.strip, player.css("div.list-info-player__player-info").text.strip, player.css("div.cost-summary__price").text.strip, player.css("div.cost-summary__effect").text.strip, player.css("span.list-info-player__ovr-value").text.strip ) end |
.reset! ⇒ Object
34 35 36 |
# File 'lib/madden_20_market_prices/player.rb', line 34 def self.reset! self.all.clear end |