Class: Anyway::Env

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

Instance Method Summary collapse

Constructor Details

#initializeEnv

Returns a new instance of Env.



3
4
5
6
# File 'lib/anyway/env.rb', line 3

def initialize
  @data = {}
  load
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



19
20
21
22
23
24
# File 'lib/anyway/env.rb', line 19

def method_missing(meth, *args, &block)
  meth = meth.to_s.gsub(/\_/,'')
  if args.empty? and @data.key?(meth)
    @data[meth]
  end
end

Instance Method Details

#clearObject



14
15
16
17
# File 'lib/anyway/env.rb', line 14

def clear
  @data.clear
  self
end

#reloadObject



8
9
10
11
12
# File 'lib/anyway/env.rb', line 8

def reload
  clear
  load
  self
end