Class: EML::Environment
- Inherits:
-
Object
- Object
- EML::Environment
- Defined in:
- lib/eml/environment.rb
Constant Summary collapse
- ENVIRONMENTS =
%i[production test].freeze
Class Method Summary collapse
Class Method Details
.production? ⇒ Boolean
9 10 11 |
# File 'lib/eml/environment.rb', line 9 def production? to_sym == :production end |
.set(value) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/eml/environment.rb', line 23 def set(value) return @to_sym = value if ENVIRONMENTS.include?(value) error_value = value.is_a?(Symbol) ? ":#{value}" : value.to_s raise( ArgumentError, "#{error_value} is not an acceptable environment; " \ "please use either :production or :test" ) end |
.test? ⇒ Boolean
13 14 15 |
# File 'lib/eml/environment.rb', line 13 def test? to_sym == :test end |
.to_sym ⇒ Object
17 18 19 |
# File 'lib/eml/environment.rb', line 17 def to_sym @to_sym ||= set(default) end |