ministryofjustice/peoplefinder

View on GitHub
lib/rails_host.rb

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
class RailsHost
  VALID_ENVS = %w[dev staging production].freeze

  def self.env
    ENV["ENV"]
  end

  def self.method_missing(method) # rubocop:disable Style/MissingRespondToMissing
    env_name = method.to_s.sub(/\?$/, "")
    if VALID_ENVS.include?(env_name)
      env == env_name
    else
      super
    end
  end
end