Class: Environments::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/burroughs/util/environments.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEnvironment

Returns a new instance of Environment.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/burroughs/util/environments.rb', line 17

def initialize
  env = ENV.fetch("BURROUGHS_ENV", nil)
  @type = :development

  @type = if env.nil? || env.empty?
            :development
          elsif env == "production"
            :production
          elsif env == "test"
            :test
          else
            :development
          end
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



15
16
17
# File 'lib/burroughs/util/environments.rb', line 15

def type
  @type
end

Instance Method Details

#development?Boolean

Returns:

  • (Boolean)


44
45
46
47
48
# File 'lib/burroughs/util/environments.rb', line 44

def development?
  return true if @type == :development

  false
end

#production?Boolean

Returns:

  • (Boolean)


32
33
34
35
36
# File 'lib/burroughs/util/environments.rb', line 32

def production?
  return true if @type == :production

  false
end

#test?Boolean

Returns:

  • (Boolean)


38
39
40
41
42
# File 'lib/burroughs/util/environments.rb', line 38

def test?
  return true if @type == :test

  false
end