Class: ExercismConfig::Environment
- Inherits:
-
Object
- Object
- ExercismConfig::Environment
- Defined in:
- lib/exercism_config/environment.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #development? ⇒ Boolean
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(raw_env) ⇒ Environment
constructor
A new instance of Environment.
- #inspect ⇒ Object
- #production? ⇒ Boolean
- #test? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(raw_env) ⇒ Environment
Returns a new instance of Environment.
6 7 8 9 10 11 12 |
# File 'lib/exercism_config/environment.rb', line 6 def initialize(raw_env) @env = raw_env.to_s unless ALLOWED_ENVS.include?(env) raise Exercism::ConfigError, "environment must be one of development, test or production. Got #{env}." end end |
Instance Method Details
#==(other) ⇒ Object
14 15 16 |
# File 'lib/exercism_config/environment.rb', line 14 def ==(other) env == other.to_s end |
#development? ⇒ Boolean
34 35 36 |
# File 'lib/exercism_config/environment.rb', line 34 def development? env == "development" end |
#eql?(other) ⇒ Boolean
18 19 20 |
# File 'lib/exercism_config/environment.rb', line 18 def eql?(other) env == other.to_s end |
#hash ⇒ Object
22 23 24 |
# File 'lib/exercism_config/environment.rb', line 22 def hash env.hash end |
#inspect ⇒ Object
30 31 32 |
# File 'lib/exercism_config/environment.rb', line 30 def inspect env end |
#production? ⇒ Boolean
42 43 44 |
# File 'lib/exercism_config/environment.rb', line 42 def production? env == "production" end |
#test? ⇒ Boolean
38 39 40 |
# File 'lib/exercism_config/environment.rb', line 38 def test? env == "test" end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/exercism_config/environment.rb', line 26 def to_s env end |