Module: Environments
- Defined in:
- lib/environments.rb,
lib/environments/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"- @@current_environment =
ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
Class Method Summary collapse
- .current ⇒ Object
- .current=(value) ⇒ Object
- .deployed? ⇒ Boolean
- .development? ⇒ Boolean
- .production? ⇒ Boolean
- .reload ⇒ Object
- .staging? ⇒ Boolean
- .test? ⇒ Boolean
Class Method Details
.current ⇒ Object
6 7 8 |
# File 'lib/environments.rb', line 6 def self.current @@current_environment end |
.current=(value) ⇒ Object
10 11 12 13 14 |
# File 'lib/environments.rb', line 10 def self.current=(value) raise ArgumentError.new('Value must be a String') unless value.is_a? String @@current_environment = value end |
.deployed? ⇒ Boolean
32 33 34 |
# File 'lib/environments.rb', line 32 def self.deployed? production? || staging? end |
.development? ⇒ Boolean
24 25 26 |
# File 'lib/environments.rb', line 24 def self.development? @@current_environment == 'development' end |
.production? ⇒ Boolean
16 17 18 |
# File 'lib/environments.rb', line 16 def self.production? @@current_environment == 'production' end |
.reload ⇒ Object
36 37 38 |
# File 'lib/environments.rb', line 36 def self.reload @@current_environment = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development' end |
.staging? ⇒ Boolean
20 21 22 |
# File 'lib/environments.rb', line 20 def self.staging? @@current_environment == 'staging' end |
.test? ⇒ Boolean
28 29 30 |
# File 'lib/environments.rb', line 28 def self.test? @@current_environment == 'test' end |