Module: CompareHacks

Included in:
Float, Integer, Rational
Defined in:
lib/z3/hacks.rb

Instance Method Summary collapse

Instance Method Details

#!=(other) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/z3/hacks.rb', line 28

def !=(other)
  if other.is_a?(Z3::Expr)
    raise ArgumentError.new unless other.respond_to?(:coerce)
    a, b = other.coerce(self)
    return a != b
  end
  super
end

#<(other) ⇒ Object



64
65
66
67
68
69
70
71
# File 'lib/z3/hacks.rb', line 64

def <(other)
  if other.is_a?(Z3::Expr)
    raise ArgumentError.new unless other.respond_to?(:coerce)
    a, b = other.coerce(self)
    return a < b
  end
  super
end

#<=(other) ⇒ Object



55
56
57
58
59
60
61
62
# File 'lib/z3/hacks.rb', line 55

def <=(other)
  if other.is_a?(Z3::Expr)
    raise ArgumentError.new unless other.respond_to?(:coerce)
    a, b = other.coerce(self)
    return a <= b
  end
  super
end

#==(other) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/z3/hacks.rb', line 19

def ==(other)
  if other.is_a?(Z3::Expr)
    raise ArgumentError.new unless other.respond_to?(:coerce)
    a, b = other.coerce(self)
    return a == b
  end
  super
end

#>(other) ⇒ Object



46
47
48
49
50
51
52
53
# File 'lib/z3/hacks.rb', line 46

def >(other)
  if other.is_a?(Z3::Expr)
    raise ArgumentError.new unless other.respond_to?(:coerce)
    a, b = other.coerce(self)
    return a > b
  end
  super
end

#>=(other) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/z3/hacks.rb', line 37

def >=(other)
  if other.is_a?(Z3::Expr)
    raise ArgumentError.new unless other.respond_to?(:coerce)
    a, b = other.coerce(self)
    return a >= b
  end
  super
end