Class: Gluez::OptionWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/gluez/option_wrapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ OptionWrapper

Returns a new instance of OptionWrapper.



3
4
5
# File 'lib/gluez/option_wrapper.rb', line 3

def initialize(options)
  @options = options
end

Instance Method Details

#[](name, default = nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gluez/option_wrapper.rb', line 11

def [](name, default=nil)
  value = @options[name]
  if value
    value
  else
    if default
      default
    else
      raise "missing option: #{name}"
    end
  end
end

#key?(key) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/gluez/option_wrapper.rb', line 7

def key?(key)
  @options.key?(key)
end