module Occi::Helpers::Comparators::Collection
Constants
- REQUIRED_ACCESSORS
Public Instance Methods
==(obj)
click to toggle source
# File lib/occi4/helpers/comparators/collection.rb, line 8 def ==(obj) return false unless obj && has_accessors?(obj) contents_matches?(obj) end
eql?(obj)
click to toggle source
# File lib/occi4/helpers/comparators/collection.rb, line 13 def eql?(obj) self == obj end
hash()
click to toggle source
# File lib/occi4/helpers/comparators/collection.rb, line 17 def hash REQUIRED_ACCESSORS.collect { |accessor| self.send(accessor) }.hash end
Private Instance Methods
contents_matches?(obj)
click to toggle source
# File lib/occi4/helpers/comparators/collection.rb, line 29 def contents_matches?(obj) result = true REQUIRED_ACCESSORS.each { |accessor| result = result && (self.send(accessor) == obj.send(accessor)) } result end
has_accessors?(obj)
click to toggle source
# File lib/occi4/helpers/comparators/collection.rb, line 21 def has_accessors?(obj) result = true REQUIRED_ACCESSORS.each { |accessor| result = result && obj.respond_to?(accessor) } result end