Class: Uncomtrade::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/uncomtrade/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Options

Returns a new instance of Options.



9
10
11
# File 'lib/uncomtrade/options.rb', line 9

def initialize(opts={})
  set_options(opts)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/uncomtrade/options.rb', line 7

def options
  @options
end

Instance Method Details

#list_optionsObject



27
28
29
# File 'lib/uncomtrade/options.rb', line 27

def list_options
  options
end

#resetObject



23
24
25
# File 'lib/uncomtrade/options.rb', line 23

def reset
  set_options
end

#update(opts = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/uncomtrade/options.rb', line 13

def update(opts={})
  opts.each do |key, value|
    if [:p,:r].include?(key)
      self.options[key] = iso_code(value)
    else
      self.options[key] = value if key != :fmt # don't let user update :fmt
    end
  end
end