Module: Infinity::Methods

Included in:
Infinity, Infinity
Defined in:
lib/infinity.rb

Instance Method Summary collapse

Instance Method Details

#*(obj) ⇒ Object



16
17
18
19
20
# File 'lib/infinity.rb', line 16

def *(obj)
  return 0 if obj == 0 or obj == 0.0
  return nil if obj == nil
  self
end

#+(obj) ⇒ Object



3
4
5
# File 'lib/infinity.rb', line 3

def +(obj)
  self
end

#-(obj) ⇒ Object



6
7
8
9
10
# File 'lib/infinity.rb', line 6

def -(obj)
  return 0 if obj == Infinity
  return 0 if obj.kind_of? Infinity
  self
end

#/(obj) ⇒ Object



11
12
13
14
15
# File 'lib/infinity.rb', line 11

def /(obj)
  return 1 if obj == Infinity
  return 1 if obj.kind_of? Infinity
  self
end

#<(obj) ⇒ Object



26
27
28
29
30
# File 'lib/infinity.rb', line 26

def <(obj)
  return false if obj == Infinity
  return false if obj.kind_of? Infinity
  false
end

#>(obj) ⇒ Object



21
22
23
24
25
# File 'lib/infinity.rb', line 21

def >(obj)
  return false if obj == Infinity
  return false if obj.kind_of? Infinity
  true
end