Class: ActionThrottler::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/action_throttler/config.rb

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



3
4
5
# File 'lib/action_throttler/config.rb', line 3

def initialize
  @config ||= {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(key, value) ⇒ Object



11
12
13
14
15
16
# File 'lib/action_throttler/config.rb', line 11

def method_missing(key, value)
  # converts `key=()` methods to `key()`
  key = key.to_s.sub(/=$/, "").to_sym
  
  @config[key] = value
end

Instance Method Details

#to_hashObject



7
8
9
# File 'lib/action_throttler/config.rb', line 7

def to_hash
  @config
end