Module: Unity::Comparison

Extended by:
ActiveSupport::Concern
Includes:
Dimension::Integer
Included in:
Conversion
Defined in:
lib/unity/comparison.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from Dimension::Integer

#dimension_int, #property, #property_name

Instance Method Details

#==(other) ⇒ Object



27
28
29
# File 'lib/unity/comparison.rb', line 27

def == other
  self.compatible?(other) && self.convert_to(other).value == other.value
end

#compatible!(other) ⇒ Object



23
24
25
# File 'lib/unity/comparison.rb', line 23

def compatible! other
  compatible?(other) ? true : raise(IncompatibleError)
end

#compatible?(other) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/unity/comparison.rb', line 19

def compatible? other
  self.dimension_int == other.dimension_int
end