Class: Object

Inherits:
BasicObject
Defined in:
lib/is_same/core_ext/object.rb,
lib/is_same/core_ext/backward_compliability/object.rb

Instance Method Summary collapse

Instance Method Details

#is_same?(object) ⇒ Boolean

For backward compliability

Returns:

  • (Boolean)


3
4
5
# File 'lib/is_same/core_ext/backward_compliability/object.rb', line 3

def is_same?(object)
  matching? object
end

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

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
# File 'lib/is_same/core_ext/object.rb', line 3

def matching?(object=nil, &block)
  if object.is_a?(Proc) or block
    object ||= block
    object.call(self)
  else
    self == object
  end
end