Sha256: 664370f510d788c6e9088248e202c8f971382c56422e6985a0a6d931f540d73d

Contents?: true

Size: 474 Bytes

Versions: 9

Compression:

Stored size: 474 Bytes

Contents

module ValueEquals
  def ==(other)
    return false unless instance_variables.size == other.instance_variables.size
    instance_variables.all? {|var| self.instance_variable_get(var) == other.instance_variable_get(var)}
  end
end

class Movie
  include ValueEquals
  
  attr_accessor :title, :director, :writers
end

class Director
  include ValueEquals
  
  attr_accessor :name, :awards
end

class AcademyAward
  include ValueEquals
  
  attr_accessor :year, :category
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
mongo_doc-0.3.1 features/step_definitions/objects.rb
mongo_doc-0.3.0 features/step_definitions/objects.rb
mongodoc-0.2.4 features/step_definitions/objects.rb
mongodoc-0.2.2 features/step_definitions/objects.rb
mongodoc-0.2.1 features/step_definitions/objects.rb
mongodoc-0.2.0 features/step_definitions/objects.rb
mongodoc-0.1.2 features/step_definitions/objects.rb
mongodoc-0.1.1 features/step_definitions/objects.rb
mongodoc-0.1.0 features/step_definitions/objects.rb