Class: Frepl::Main
- Inherits:
-
Object
- Object
- Frepl::Main
- Defined in:
- lib/frepl.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Main
constructor
A new instance of Main.
- #run ⇒ Object
- #run_file(file) ⇒ Object
Constructor Details
#initialize ⇒ Main
Returns a new instance of Main.
27 28 29 30 31 |
# File 'lib/frepl.rb', line 27 def initialize Frepl.compiler = 'gfortran' Frepl.debug = false reset! end |
Class Method Details
.run ⇒ Object
22 23 24 |
# File 'lib/frepl.rb', line 22 def run new.run end |
Instance Method Details
#run ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/frepl.rb', line 33 def run loop do begin while buf = Readline.readline(prompt, true) @lines << buf process_line(buf) end rescue Interrupt @classifier.interrupt puts "^C\n" rescue SystemExit, SignalException raise rescue Exception => e puts "Exception!: #{e}" puts e.backtrace raise end end end |
#run_file(file) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/frepl.rb', line 53 def run_file(file) file.each do |line| @lines << line process_line(line) end reset! end |