Sha256: 626ea7bfae3496def60f4edc133f8e147c66e1391c4983b3fb6895c35c8482e7
Contents?: true
Size: 747 Bytes
Versions: 2
Compression:
Stored size: 747 Bytes
Contents
#!/usr/bin/env ruby require File.join(File.dirname(__FILE__), "..", "lib", "maths") # The main script! parser = Maths::Calculator.new puts puts "Welcome to maths (version #{Maths::VERSION})!" puts "Type \"exit\" to quit." puts Readline.completion_proc = Proc.new do |str| # TODO: Get this working end prompt = "maths> " while command = Readline.readline(prompt, true) break if /exit/i =~ command if command == "vars" || command == "variables" puts puts "Defined Variables:" Maths::Brain.read.each do |key, value| puts "#{key}: #{value}" end puts else begin result = parser.parse(command) puts "= #{Maths::Formatter.format(result)}" rescue ParseError puts $! end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
maths-0.0.5 | bin/maths |
maths-0.0.4 | bin/maths |