class OmiseGO::Configuration

Constants

OMISEGO_OPTIONS
OPTIONS

Public Class Methods

new(options = {}) click to toggle source
# File lib/omisego/configuration.rb, line 32
def initialize(options = {})
  OPTIONS.each do |name, val|
    value = options ? options[name] || options[name.to_sym] : nil
    value ||= val.call if val.respond_to?(:call)
    instance_variable_set("@#{name}", value)
  end

  OMISEGO_OPTIONS.each do |name, value|
    instance_variable_set("@#{name}", value)
  end
end

Public Instance Methods

[](option) click to toggle source
# File lib/omisego/configuration.rb, line 44
def [](option)
  instance_variable_get("@#{option}")
end
merge(options) click to toggle source
# File lib/omisego/configuration.rb, line 54
def merge(options)
  OPTIONS.each_key do |name|
    instance_variable_set("@#{name}", options[name]) if options[name]
  end
end
to_hash() click to toggle source
# File lib/omisego/configuration.rb, line 48
def to_hash
  OPTIONS.keys.each_with_object({}) do |option, hash|
    hash[option.to_sym] = self[option]
  end
end