Sha256: 01b8c4ed071d83392032afdbcf6944658e0d3ff3b1bf4fd17d157e9b4f6d74ae

Contents?: true

Size: 482 Bytes

Versions: 42

Compression:

Stored size: 482 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

42 entries across 42 versions & 7 rubygems

Version Path
activesupport-6.1.7.10 lib/active_support/environment_inquirer.rb
activesupport-6.1.7.9 lib/active_support/environment_inquirer.rb
activesupport-6.1.7.8 lib/active_support/environment_inquirer.rb
activesupport-6.1.7.7 lib/active_support/environment_inquirer.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/environment_inquirer.rb
activesupport-6.1.7.6 lib/active_support/environment_inquirer.rb
activesupport-6.1.7.5 lib/active_support/environment_inquirer.rb
activesupport-6.1.7.4 lib/active_support/environment_inquirer.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/environment_inquirer.rb
activesupport-6.1.7.3 lib/active_support/environment_inquirer.rb
activesupport-6.1.7.2 lib/active_support/environment_inquirer.rb
activesupport-6.1.7.1 lib/active_support/environment_inquirer.rb
activesupport-6.1.7 lib/active_support/environment_inquirer.rb
activesupport-6.1.6.1 lib/active_support/environment_inquirer.rb
activesupport-6.1.6 lib/active_support/environment_inquirer.rb
activesupport-6.1.5.1 lib/active_support/environment_inquirer.rb
activesupport-6.1.5 lib/active_support/environment_inquirer.rb
activesupport-6.1.4.7 lib/active_support/environment_inquirer.rb
activesupport-6.1.4.6 lib/active_support/environment_inquirer.rb
activesupport-6.1.4.5 lib/active_support/environment_inquirer.rb