Class: AntiCaptcha::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/anti-captcha/configuration.rb

Constant Summary collapse

@@config_keys =
[]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.config_key(key, default_value = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/anti-captcha/configuration.rb', line 6

def self.config_key(key, default_value = nil)
  attr_accessor key
  @@config_keys << key
  if default_value
    define_method key do
      instance_variable_get(:"@#{key}") || default_value
    end
  end
end

Instance Method Details

#optionsObject



25
26
27
28
29
# File 'lib/anti-captcha/configuration.rb', line 25

def options
  @@config_keys.each_with_object({}) do |key, hash|
    hash[key] = __send__(key) if __send__(key)
  end
end