Class: Environment

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

Instance Method Summary collapse

Constructor Details

#initializeEnvironment

Returns a new instance of Environment.



2
3
4
# File 'lib/yodel/config/environment.rb', line 2

def initialize
  @env = ENV['YODEL_ENV'] || 'development'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/yodel/config/environment.rb', line 6

def method_missing(sym, *args)
  sym = sym.to_s
  if sym.end_with?('!')
    @env = sym[0..-2]
  elsif sym.end_with?('?')
    @env == sym[0..-2]
  else
    super
  end
end