Class: Lol::Model
- Inherits:
-
Object
- Object
- Lol::Model
- Defined in:
- lib/lol/model.rb
Direct Known Subclasses
Champion, ChampionStatisticsSummary, Game, League, LeagueEntry, MasteryPage, MatchSummary, MiniSeries, Player, PlayerStatistic, RankedStatisticsSummary, Roster, Rune, RunePage, RuneSlot, Summoner, Talent, Team, TeamMember, TeamStatistic
Instance Attribute Summary collapse
-
#raw ⇒ Hash
readonly
Raw version of options Hash used to initialize Model.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Lol::Model
constructor
Initializes a Lol::Model.
-
#inspect ⇒ String
Re-written Object#inspect to skip the @raw instance variable.
Constructor Details
#initialize(options = {}) ⇒ Lol::Model
Initializes a Lol::Model
12 13 14 15 16 17 |
# File 'lib/lol/model.rb', line 12 def initialize = {} @raw = .each do |attribute_name, value| send "#{attribute_name.to_s.underscore}=", value end end |
Instance Attribute Details
#raw ⇒ Hash (readonly)
Returns raw version of options Hash used to initialize Model.
7 8 9 |
# File 'lib/lol/model.rb', line 7 def raw @raw end |
Instance Method Details
#inspect ⇒ String
Re-written Object#inspect to skip the @raw instance variable
21 22 23 24 25 26 |
# File 'lib/lol/model.rb', line 21 def inspect vars = self.instance_variables. select {|v| v != :@raw}. map{|v| "#{v}=#{instance_variable_get(v).inspect}"}.join(", ") "<#{self.class}: #{vars}>" end |