Class: Obfuscator::Division

Inherits:
BinaryExpression show all
Defined in:
lib/number_obfuscator/division.rb

Instance Attribute Summary

Attributes inherited from BinaryExpression

#left, #right

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BinaryExpression

#initialize, make

Methods inherited from Expression

addType, make, makeExpression

Constructor Details

This class inherits a constructor from Obfuscator::BinaryExpression

Class Method Details

.canDo(n) ⇒ Object


16
17
18
# File 'lib/number_obfuscator/division.rb', line 16

def Division.canDo(n)
  n > 1
end

.makePair(n) ⇒ Object


20
21
22
23
24
# File 'lib/number_obfuscator/division.rb', line 20

def Division.makePair(n)
  r = rand(300) + 70
  l = r * n
  [l, r]
end

Instance Method Details

#to_sObject


8
9
10
# File 'lib/number_obfuscator/division.rb', line 8

def to_s
  "(#{left.to_s})/(#{right.to_s})"
end

#to_texObject


12
13
14
# File 'lib/number_obfuscator/division.rb', line 12

def to_tex
  "\\frac{#{left.to_tex}}{#{right.to_tex}}"
end