Sha256: a907d2bbabd00fd6c43664f8f7512bb7009fa54f6efb3e915a1dd5fd65db8472

Contents?: true

Size: 483 Bytes

Versions: 47

Compression:

Stored size: 483 Bytes

Contents

# frozen_string_literal: true

require "active_support/string_inquirer"

module ActiveSupport
  class EnvironmentInquirer < StringInquirer # :nodoc:
    DEFAULT_ENVIRONMENTS = ["development", "test", "production"]
    def initialize(env)
      super(env)

      DEFAULT_ENVIRONMENTS.each do |default|
        instance_variable_set :"@#{default}", env == default
      end
    end

    DEFAULT_ENVIRONMENTS.each do |env|
      class_eval "def #{env}?; @#{env}; end"
    end
  end
end

Version data entries

47 entries across 44 versions & 8 rubygems

Version Path
activesupport-7.0.8.7 lib/active_support/environment_inquirer.rb
activesupport-7.0.8.6 lib/active_support/environment_inquirer.rb
activesupport-7.0.8.5 lib/active_support/environment_inquirer.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8.4/lib/active_support/environment_inquirer.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/activesupport-7.0.5.1/lib/active_support/environment_inquirer.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/activesupport-7.0.5.1/lib/active_support/environment_inquirer.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/activesupport-7.0.5.1/lib/active_support/environment_inquirer.rb
activesupport-7.0.8.4 lib/active_support/environment_inquirer.rb
activesupport-7.0.8.1 lib/active_support/environment_inquirer.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activesupport-7.0.3.1/lib/active_support/environment_inquirer.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activesupport-7.0.2.3/lib/active_support/environment_inquirer.rb
activesupport-7.0.8 lib/active_support/environment_inquirer.rb
activesupport-7.0.7.2 lib/active_support/environment_inquirer.rb
activesupport-7.0.7.1 lib/active_support/environment_inquirer.rb
activesupport-7.0.7 lib/active_support/environment_inquirer.rb
mlh-rubocop-config-1.0.2 vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.6/lib/active_support/environment_inquirer.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.5/lib/active_support/environment_inquirer.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.6/lib/active_support/environment_inquirer.rb
activesupport-7.0.6 lib/active_support/environment_inquirer.rb
activesupport-7.0.5.1 lib/active_support/environment_inquirer.rb