Class: LOLastfm::Checker::Settings
- Inherits:
-
Object
- Object
- LOLastfm::Checker::Settings
- Defined in:
- lib/LOLastfm/checker.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
Instance Method Summary collapse
-
#initialize(checker, data) ⇒ Settings
constructor
A new instance of Settings.
- #method_missing(id, *args, &block) ⇒ Object
- #respond_to_missing?(id) ⇒ Boolean
Constructor Details
#initialize(checker, data) ⇒ Settings
Returns a new instance of Settings.
17 18 19 20 |
# File 'lib/LOLastfm/checker.rb', line 17 def initialize (checker, data) @data = data.to_hash @default = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id, *args, &block) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/LOLastfm/checker.rb', line 26 def method_missing (id, *args, &block) if @default.respond_to? id return @default.merge(@data).__send__ id, *args, &block end super end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
15 16 17 |
# File 'lib/LOLastfm/checker.rb', line 15 def default @default end |
Instance Method Details
#respond_to_missing?(id) ⇒ Boolean
22 23 24 |
# File 'lib/LOLastfm/checker.rb', line 22 def respond_to_missing? (id) @data.respond_to?(id) end |