Module: HashMethodAccessor
- Included in:
- LolReplay::Game, LolReplay::Player
- Defined in:
- lib/lolreplay/hash_method_accessor.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id, *args) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'lib/lolreplay/hash_method_accessor.rb', line 2 def method_missing id, *args hash_key = id.to_s.gsub(/_./) { $&[1].chr.upcase }.to_sym if @data[hash_key].nil? super else @data[hash_key] end end |