Class: Cinch::Plugins::SimpleCalc

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/cinch/plugins/simplecalc/simplecalc.rb

Instance Method Summary collapse

Instance Method Details

#execute(m, problem) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cinch/plugins/simplecalc/simplecalc.rb', line 14

def execute(m, problem)
  begin
    answer = Calc.evaluate(problem)

    unless answer == problem
      m.reply "#{Calc.evaluate(problem)}", true
    end
  rescue ZeroDivisionError
    m.reply "Fuck you.", true
  end
end