Sha256: 9279567220e80eae19617e46ea71ed013dacb139fc209d36581d25906d554ba5

Contents?: true

Size: 461 Bytes

Versions: 46

Compression:

Stored size: 461 Bytes

Contents

module Steep
  module Equatable
    def ==(other)
      if other.class == self.class
        instance_variables.all? do |name|
          other.instance_variable_get(name) == instance_variable_get(name)
        end
      else
        false
      end
    end

    def eql?(other)
      self == other
    end

    def hash
      instance_variables.inject(self.class.hash) do |hash, name|
        hash ^ instance_variable_get(name).hash
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
steep-1.9.1 lib/steep/equatable.rb
steep-1.9.0 lib/steep/equatable.rb
steep-1.9.0.dev.2 lib/steep/equatable.rb
steep-1.9.0.dev.1 lib/steep/equatable.rb
steep-1.8.3 lib/steep/equatable.rb
steep-1.8.2 lib/steep/equatable.rb
steep-1.8.1 lib/steep/equatable.rb
steep-1.8.0 lib/steep/equatable.rb
steep-1.8.0.pre.2 lib/steep/equatable.rb
steep-1.8.0.pre.1 lib/steep/equatable.rb
steep-1.8.0.dev.2 lib/steep/equatable.rb
steep-1.8.0.dev.1 lib/steep/equatable.rb
steep-1.7.1 lib/steep/equatable.rb
steep-1.7.0 lib/steep/equatable.rb
steep-1.7.0.dev.3 lib/steep/equatable.rb
steep-1.7.0.dev.2 lib/steep/equatable.rb
steep-1.7.0.dev.1 lib/steep/equatable.rb
steep-1.6.0 lib/steep/equatable.rb
steep-1.6.0.pre.4 lib/steep/equatable.rb
steep-1.6.0.pre.3 lib/steep/equatable.rb