Class: Gorgerb::PlayerStatistics
- Inherits:
-
Object
- Object
- Gorgerb::PlayerStatistics
- Defined in:
- lib/gorgerb/player_statistics.rb
Defined Under Namespace
Classes: Accuracy, KDR, MarineAccuracy
Instance Attribute Summary collapse
-
#accuracy ⇒ Object
readonly
Returns the value of attribute accuracy.
-
#kdr ⇒ Object
readonly
Returns the value of attribute kdr.
-
#steam_id ⇒ Object
readonly
Returns the value of attribute steam_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(steam_id, kdr, accuracy) ⇒ PlayerStatistics
constructor
A new instance of PlayerStatistics.
Constructor Details
#initialize(steam_id, kdr, accuracy) ⇒ PlayerStatistics
Returns a new instance of PlayerStatistics.
33 34 35 36 37 |
# File 'lib/gorgerb/player_statistics.rb', line 33 def initialize(steam_id, kdr, accuracy) @steam_id = steam_id @kdr = kdr @accuracy = accuracy end |
Instance Attribute Details
#accuracy ⇒ Object (readonly)
Returns the value of attribute accuracy.
9 10 11 |
# File 'lib/gorgerb/player_statistics.rb', line 9 def accuracy @accuracy end |
#kdr ⇒ Object (readonly)
Returns the value of attribute kdr.
9 10 11 |
# File 'lib/gorgerb/player_statistics.rb', line 9 def kdr @kdr end |
#steam_id ⇒ Object (readonly)
Returns the value of attribute steam_id.
9 10 11 |
# File 'lib/gorgerb/player_statistics.rb', line 9 def steam_id @steam_id end |
Class Method Details
.from_hsh(data) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/gorgerb/player_statistics.rb', line 11 def self.from_hsh(data) kdr_data = data.fetch('kdr') accuracy_data = data.fetch('accuracy') steam_id = data.fetch 'steam_id' kdr = KDR.new( kdr_data.fetch('total'), kdr_data.fetch('alien'), kdr_data.fetch('marine') ) accuracy = Accuracy.new( accuracy_data.fetch('total'), accuracy_data.fetch('alien'), MarineAccuracy.new( accuracy_data.fetch('marine').fetch('total'), accuracy_data.fetch('marine').fetch('no_onos'), ) ) PlayerStatistics.new(steam_id, kdr, accuracy) end |