Sha256: 589a3444522c3aacf88cf140a62983ab0ad300f7b6bd85fac7daaf8383fdf257

Contents?: true

Size: 530 Bytes

Versions: 489

Compression:

Stored size: 530 Bytes

Contents

module ActiveSupport
  # Wrapping a string in this class gives you a prettier way to test
  # for equality. The value returned by <tt>Rails.env</tt> is wrapped
  # in a StringInquirer object so instead of calling this:
  #
  #   Rails.env == "production"
  #
  # you can call this:
  #
  #   Rails.env.production?
  #
  class StringInquirer < String
    def method_missing(method_name, *arguments)
      if method_name.to_s[-1,1] == "?"
        self == method_name.to_s[0..-2]
      else
        super
      end
    end
  end
end

Version data entries

489 entries across 412 versions & 48 rubygems

Version Path
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/string_inquirer.rb
activesupport-3.2.22.5 lib/active_support/string_inquirer.rb
activesupport-3.2.22.4 lib/active_support/string_inquirer.rb
activesupport-3.2.22.3 lib/active_support/string_inquirer.rb
activesupport-3.2.22.2 lib/active_support/string_inquirer.rb
activesupport-3.2.22.1 lib/active_support/string_inquirer.rb
classiccms-0.7.5 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/string_inquirer.rb
classiccms-0.7.4 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/string_inquirer.rb
classiccms-0.7.3 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/string_inquirer.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/string_inquirer.rb
activesupport-3.2.22 lib/active_support/string_inquirer.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.12/lib/active_support/string_inquirer.rb
activesupport-3.2.21 lib/active_support/string_inquirer.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/activesupport-3.2.18/lib/active_support/string_inquirer.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/activesupport-3.2.18/lib/active_support/string_inquirer.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/string_inquirer.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.18/lib/active_support/string_inquirer.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/string_inquirer.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.18/lib/active_support/string_inquirer.rb
activesupport-3.2.20 lib/active_support/string_inquirer.rb