Sha256: 156808db8eb96b89177a10db633b7450d01e823497a597e3833accef91c9a736
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
# frozen_string_literal: true # @api private # @since 0.1.0 module SmartCore::ValueObject::Interface::Comparable class << self # @param base_klass [Class<SmartCore::ValueObject>] # @return [void] # # @api private # @since 0.1.0 def included(base_klass) base_klass.include(::Comparable) base_klass.include(Comparability) end end # @api private # @since 0.1.0 module Comparability # @param another_object [Any] # @return [Boolean] # # @api public # @since 0.1.0 def <(another_object) false end # @param another_object [Any] # @return [Boolean] # # @api public # @since 0.1.0 def <=(another_object) false end # @param another_object [Any] # @return [Boolean] # # @api public # @since 0.1.0 def >(another_object) false end # @param another_object [Any] # @return [Boolean] # # @api public # @since 0.1.0 def >=(another_object) false end # @param another_object [SmartCore::ValueObject] # @return [Boolean] # # @api public # @since 0.1.0 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 alias_method :==, :eql? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smart_value-object-0.1.0 | lib/smart_core/value_object/interface/comparable.rb |