module Ravioli::StagingInquirer

A module that we mix in to the `Rails.env` inquirer class to add some extra staging-related metadata

Public Instance Methods

name() click to toggle source

Add a `name` method to `Rails.env` that will return “staging” for staging environments, and otherwise the string's value

# File lib/ravioli/staging_inquirer.rb, line 9
def name
  staging? ? "staging" : to_s
end
production?(strict: false) click to toggle source

Add a `strict:` keyword to reduce `Rails.env.production && !Rails.env.staging` calls

Calls superclass method
# 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?() click to toggle source

Override staging inquiries to check against the current configuration

# File lib/ravioli/staging_inquirer.rb, line 22
def staging?
  Rails.try(:config)&.staging?
end