Sha256: 72dde4046db202cb40ea99b08eb4c4563ab9f15c9797aa762017946b7d375f34

Contents?: true

Size: 436 Bytes

Versions: 3

Compression:

Stored size: 436 Bytes

Contents

# https://github.com/rails/rails/edit/master/activesupport/lib/active_support/string_inquirer.rb
module A9n
  class StringInquirer < String
    private

    def respond_to_missing?(method_name, include_private = false)
      (method_name[-1] == "?") || super
    end

    def method_missing(method_name, *arguments)
      if method_name[-1] == "?"
        self == method_name[0..-2]
      else
        super
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
a9n-0.6.2 lib/a9n/ext/string_inquirer.rb
a9n-0.6.1 lib/a9n/ext/string_inquirer.rb
a9n-0.6.0 lib/a9n/ext/string_inquirer.rb