Module: SmartCore::ValueObject::Interface::Comparable::Comparability Private

Defined in:
lib/smart_core/value_object/interface/comparable.rb

Overview

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

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#<(another_object) ⇒ Boolean

Parameters:

  • another_object (Any)

Returns:

  • (Boolean)

Since:

  • 0.1.0



26
27
28
# File 'lib/smart_core/value_object/interface/comparable.rb', line 26

def <(another_object)
  false
end

#<=(another_object) ⇒ Boolean

Parameters:

  • another_object (Any)

Returns:

  • (Boolean)

Since:

  • 0.1.0



35
36
37
# File 'lib/smart_core/value_object/interface/comparable.rb', line 35

def <=(another_object)
  false
end

#>(another_object) ⇒ Boolean

Parameters:

  • another_object (Any)

Returns:

  • (Boolean)

Since:

  • 0.1.0



44
45
46
# File 'lib/smart_core/value_object/interface/comparable.rb', line 44

def >(another_object)
  false
end

#>=(another_object) ⇒ Boolean

Parameters:

  • another_object (Any)

Returns:

  • (Boolean)

Since:

  • 0.1.0



53
54
55
# File 'lib/smart_core/value_object/interface/comparable.rb', line 53

def >=(another_object)
  false
end

#eql?(another_object) ⇒ Boolean Also known as: ==

rubocop:disable Style/RedundantSelf

Parameters:

Returns:

  • (Boolean)

Since:

  • 0.1.0



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/smart_core/value_object/interface/comparable.rb', line 63

def eql?(another_object)
  self.class <= another_object.class && (
    self.class.__params__.all? do |attribute|
      self.__send__(attribute.name) == another_object.__send__(attribute.name)
    end
  ) && (
    self.class.__options__.all? do |property|
      self.__send__(property.name) == another_object.__send__(property.name)
    end
  )
end