Class: Playmo::Options

Inherits:
Object show all
Includes:
Singleton
Defined in:
lib/playmo/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#options_hashObject

Returns the value of attribute options_hash.



6
7
8
# File 'lib/playmo/options.rb', line 6

def options_hash
  @options_hash
end

Instance Method Details

#get(key) ⇒ Object



15
16
17
# File 'lib/playmo/options.rb', line 15

def get(key)
  @options_hash[key.to_sym]
end

#set(key, value) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
# File 'lib/playmo/options.rb', line 8

def set(key, value)
  raise ArgumentError, "Cannot set key as nil!" if key.nil?
  
  @options_hash ||= {}
  @options_hash[key.to_sym] = value
end