class Nard::Appi::Environment

Public Class Methods

new() click to toggle source
# File lib/nard/appi/environment.rb, line 10
def initialize
  default_environment = :production
  @env = default_environment
end

Public Instance Methods

development?() click to toggle source
# File lib/nard/appi/environment.rb, line 27
def development?
  @env == :development
end
method_missing( method_name, *args, &block ) click to toggle source
Calls superclass method
# File lib/nard/appi/environment.rb, line 43
def method_missing( method_name, *args, &block )
  condition = respond_to?( method_name ) and args.length == 0 and !( block_given? )
  if condition
    /\A(.+)\?\Z/ === method_name.to_s
    @env.to_s == $1
  else
    super
  end
end
production?() click to toggle source
# File lib/nard/appi/environment.rb, line 31
def production?
  @env == :production
end
reset!() click to toggle source
# File lib/nard/appi/environment.rb, line 23
def reset!
  update!( :production )
end
respond_to?( method_name, include_all = false ) click to toggle source
Calls superclass method
# File lib/nard/appi/environment.rb, line 53
def respond_to?( method_name, include_all = false )
  return super || /\A(.+)\?\Z/ === method_name.to_s
end
staging?() click to toggle source
# File lib/nard/appi/environment.rb, line 39
def staging?
  @env == :staging
end
test?() click to toggle source
# File lib/nard/appi/environment.rb, line 35
def test?
  @env == :test
end
to_sym() click to toggle source
# File lib/nard/appi/environment.rb, line 15
def to_sym
  @env
end
update!( env ) click to toggle source
# File lib/nard/appi/environment.rb, line 19
def update!( env )
  @env = env.to_sym
end