Class: String

Inherits:
Object show all
Defined in:
lib/is_same/core_ext/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#matching?(object = nil, &block) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/is_same/core_ext/core_ext.rb', line 56

def matching? object=nil, &block
  case object
  when Class
    self == object.name
  when Numeric, Symbol
    self == object.to_s
  when Regexp
    !!object.match(self)
  else
    super object, &block
  end
end