Class: Web::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



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

def initialize
  @config = {}
  @docs = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/web/config.rb', line 36

def method_missing( symbol, *args )
  if args.empty?
    self[symbol]
  else
    super( symbol, *args )
  end
end

Instance Attribute Details

#docsObject (readonly)

Returns the value of attribute docs.



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

def docs
  @docs
end

Instance Method Details

#[](key) ⇒ Object



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

def [] (key)
  @config[key.to_s]
end

#[]=(key, value) ⇒ Object



24
25
26
# File 'lib/web/config.rb', line 24

def []= (key, value)
  @config[key.to_s] = value
end

#describe(info = {}) ⇒ Object



28
29
30
# File 'lib/web/config.rb', line 28

def describe( info={} )
  @docs.merge! info
end

#set(values = {}) ⇒ Object



32
33
34
# File 'lib/web/config.rb', line 32

def set( values={} )
  @config.merge! values
end