Class: Literal::Types::SameObjectType Private

Inherits:
Object
  • Object
show all
Includes:
Literal::Type
Defined in:
lib/literal/types/same_object_type.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

EQUAL_METHOD =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

BasicObject.instance_method(:equal?)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Literal::Type

#<=

Constructor Details

#initialize(object) ⇒ SameObjectType

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SameObjectType.



9
10
11
12
# File 'lib/literal/types/same_object_type.rb', line 9

def initialize(object)
  @object = object
  freeze
end

Instance Attribute Details

#objectObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
# File 'lib/literal/types/same_object_type.rb', line 14

def object
  @object
end

Instance Method Details

#===(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/literal/types/same_object_type.rb', line 16

def ===(value)
  EQUAL_METHOD.bind_call(@object, value)
end

#>=(other, context: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
23
24
25
26
27
# File 'lib/literal/types/same_object_type.rb', line 20

def >=(other, context: nil)
  case other
  when Literal::Types::SameObjectType
    EQUAL_METHOD.bind_call(@object, other.object)
  else
    false
  end
end