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
depengine-0.0.25 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
depengine-0.0.24 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
depengine-0.0.24 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
depengine-0.0.23 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
depengine-0.0.23 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
depengine-0.0.22 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
depengine-0.0.22 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
depengine-0.0.21 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
depengine-0.0.21 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
depengine-0.0.20 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
depengine-0.0.20 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
depengine-0.0.19 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
depengine-0.0.19 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/string_inquirer.rb
activesupport-3.2.17 lib/active_support/string_inquirer.rb
social_url_stats-0.0.1 vendor/ruby/1.9.1/gems/activesupport-3.0.0/lib/active_support/string_inquirer.rb
activesupport-3.2.16 lib/active_support/string_inquirer.rb
activesupport-3.2.15 lib/active_support/string_inquirer.rb
activesupport-3.2.15.rc3 lib/active_support/string_inquirer.rb
activesupport-3.2.15.rc2 lib/active_support/string_inquirer.rb
activesupport-3.2.15.rc1 lib/active_support/string_inquirer.rb