Class: Burek::BurekConfiguration

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

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ BurekConfiguration

Returns a new instance of BurekConfiguration.



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

def initialize(hash)
  @hash = hash
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



18
19
20
21
22
# File 'lib/config.rb', line 18

def method_missing(m, *args, &block)
  key = m.to_s.gsub('=','').to_sym
  raise 'Unknown config key!' unless @hash.has_key? key
  @hash[key] = args.first
end

Instance Method Details

#get(key) ⇒ Object



14
15
16
# File 'lib/config.rb', line 14

def get(key)
  hash[key]
end

#hashObject



10
11
12
# File 'lib/config.rb', line 10

def hash
  @hash
end