Sha256: 1c9e59caebc9c9c95b436fd1c84123a38a2b97f3ff2a38899d1adf8285870559
Contents?: true
Size: 872 Bytes
Versions: 6
Compression:
Stored size: 872 Bytes
Contents
# frozen_string_literal: true module Capistrano module DataPlaneApi # Include in a class to make its instances capable # of comparing themselves with other objects of the same class # by calling `==` on their instance variables. module Equatable # @param other [Object] # @return [Boolean] def eql?(other) return true if equal?(other) return false unless other.is_a?(self.class) || is_a?(other.class) # @type [Set<Symbol>] self_ivars = instance_variables.to_set # @type [Set<Symbol>] other_ivars = other.instance_variables.to_set return false unless self_ivars == other_ivars self_ivars.each do |ivar| return false if instance_variable_get(ivar) != other.instance_variable_get(ivar) end true end alias == eql? end end end
Version data entries
6 entries across 6 versions & 1 rubygems