Class: Environments::Environment
- Inherits:
-
Object
- Object
- Environments::Environment
- Defined in:
- lib/burroughs/util/environments.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #development? ⇒ Boolean
-
#initialize ⇒ Environment
constructor
A new instance of Environment.
- #production? ⇒ Boolean
- #test? ⇒ Boolean
Constructor Details
#initialize ⇒ Environment
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
#type ⇒ Object (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
44 45 46 47 48 |
# File 'lib/burroughs/util/environments.rb', line 44 def development? return true if @type == :development false end |
#production? ⇒ 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
38 39 40 41 42 |
# File 'lib/burroughs/util/environments.rb', line 38 def test? return true if @type == :test false end |