Module: Ravioli::StagingInquirer
- Included in:
- Railtie
- Defined in:
- lib/ravioli/staging_inquirer.rb
Overview
A module that we mix in to the ‘Rails.env` inquirer class to add some extra staging-related metadata
Instance Method Summary collapse
-
#name ⇒ Object
Add a ‘name` method to `Rails.env` that will return “staging” for staging environments, and otherwise the string’s value.
-
#production?(strict: false) ⇒ Boolean
Add a ‘strict:` keyword to reduce `Rails.env.production && !Rails.env.staging` calls.
-
#staging? ⇒ Boolean
Override staging inquiries to check against the current configuration.
Instance Method Details
#name ⇒ Object
Add a ‘name` method to `Rails.env` that will return “staging” for staging environments, and otherwise the string’s value
9 10 11 |
# File 'lib/ravioli/staging_inquirer.rb', line 9 def name staging? ? "staging" : to_s end |
#production?(strict: false) ⇒ Boolean
Add a ‘strict:` keyword to reduce `Rails.env.production && !Rails.env.staging` calls
14 15 16 17 18 19 |
# File 'lib/ravioli/staging_inquirer.rb', line 14 def production?(strict: false) is_production = super() return is_production unless strict && is_production is_production && !staging? end |
#staging? ⇒ Boolean
Override staging inquiries to check against the current configuration
22 23 24 |
# File 'lib/ravioli/staging_inquirer.rb', line 22 def staging? Rails.try(:config)&.staging? end |