Class: LOLastfm::Checker::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/LOLastfm/checker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#defaultObject (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

Returns:

  • (Boolean)


22
23
24
# File 'lib/LOLastfm/checker.rb', line 22

def respond_to_missing? (id)
	@data.respond_to?(id)
end