Sha256: ed5b17df9ffbe5e0e58744f7f33579f1d7e3cc4e74c48adcbbc9819acfba0218

Contents?: true

Size: 836 Bytes

Versions: 18

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

class Sinclair
  module Comparable
    # @api public
    # @author darthjee
    #
    # Class methods of {Sinclair::Comparable}
    #
    # @example (see Sinclair::Comparable)
    module ClassMethods
      # Adds fields to the comparison algorythim
      #
      # @param attributes [Array<Symbol>] attributes to be added to comparison
      #
      # @see Sinclair::EqualsChecker
      # @return (see Sinclair::EqualsChecker#add)
      # @example (see Sinclair::Comparable)
      def comparable_by(*attributes)
        equals_checker.add(*attributes)
      end

      # @api private
      #
      # Returns a comparable configured for the class
      #
      # @return [Sinclair::EqualsChecker]
      def equals_checker
        @equals_checker ||= Sinclair::EqualsChecker.new
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
sinclair-2.1.1 lib/sinclair/comparable/class_methods.rb
sinclair-2.1.0 lib/sinclair/comparable/class_methods.rb
sinclair-2.0.1 lib/sinclair/comparable/class_methods.rb
sinclair-2.0.0 lib/sinclair/comparable/class_methods.rb
sinclair-1.16.3 lib/sinclair/comparable/class_methods.rb
sinclair-1.16.2 lib/sinclair/comparable/class_methods.rb
sinclair-1.16.1 lib/sinclair/comparable/class_methods.rb
sinclair-1.16.0 lib/sinclair/comparable/class_methods.rb
sinclair-1.15.0 lib/sinclair/comparable/class_methods.rb
sinclair-1.14.2 lib/sinclair/comparable/class_methods.rb
sinclair-1.14.1 lib/sinclair/comparable/class_methods.rb
sinclair-1.14.0 lib/sinclair/comparable/class_methods.rb
sinclair-1.13.0 lib/sinclair/comparable/class_methods.rb
sinclair-1.12.1 lib/sinclair/comparable/class_methods.rb
sinclair-1.12.0 lib/sinclair/comparable/class_methods.rb
sinclair-1.11.0 lib/sinclair/comparable/class_methods.rb
sinclair-1.10.0 lib/sinclair/comparable/class_methods.rb
sinclair-1.9.0 lib/sinclair/comparable/class_methods.rb