Class: Session::IDL
- Inherits:
-
AbstractSession
- Object
- AbstractSession
- Session::IDL
- Defined in:
- lib/session.rb
Overview
IDL => interactive data language - see www.rsinc.com/
Defined Under Namespace
Classes: LicenseManagerError
Constant Summary collapse
- DEFAULT_PROG =
'idl'
- MAX_TRIES =
32
Instance Attribute Summary
Attributes inherited from AbstractSession
#debug, #errproc, #history, #opts, #outproc, #prog, #stderr, #stdin, #stdout, #threads, #track_history, #use_open3, #use_spawn
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(*args) ⇒ IDL
constructor
A new instance of IDL.
- #path ⇒ Object
- #path=(arg) ⇒ Object
- #send_command(cmd) ⇒ Object
Methods inherited from AbstractSession
#__fork, #__popen3, #close!, default_prog, default_prog=, #execute, #getopt, #hasopt, init, #ready?
Constructor Details
#initialize(*args) ⇒ IDL
Returns a new instance of IDL.
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 |
# File 'lib/session.rb', line 565 def initialize(*args) tries = 0 ret = nil begin ret = super rescue LicenseManagerError => e tries += 1 if tries < MAX_TRIES sleep 1 retry else raise LicenseManagerError, "<#{ MAX_TRIES }> attempts <#{ e. }>" end end ret end |
Instance Method Details
#clear ⇒ Object
581 582 583 584 585 586 587 588 589 590 591 592 593 |
# File 'lib/session.rb', line 581 def clear stdin.puts "retall" stdin.puts "printf, -2, '__clear__'" stdin.puts "printf, -1, '__clear__'" stdin.flush while((line = stderr.gets) and line !~ %r/__clear__/o) raise LicenseManagerError, line if line =~ %r/license\s*manager/io end while((line = stdout.gets) and line !~ %r/__clear__/o) raise LicenseManagerError, line if line =~ %r/license\s*manager/io end self end |
#path ⇒ Object
605 606 607 608 |
# File 'lib/session.rb', line 605 def path stdout, stderr = execute "print, !path" stdout.strip.split %r/:/o end |
#path=(arg) ⇒ Object
609 610 611 612 613 614 615 616 617 618 619 |
# File 'lib/session.rb', line 609 def path= arg case arg when Array arg = arg.join ':' else arg = arg.to_s.strip end stdout, stderr = execute "!path='#{ arg }'" self.path end |
#send_command(cmd) ⇒ Object
594 595 596 597 598 599 600 601 602 603 604 |
# File 'lib/session.rb', line 594 def send_command cmd stdin.printf "printf, -2, '%s'\n", cmd.begin_err stdin.printf "printf, -1, '%s'\n", cmd.begin_out stdin.printf "%s\n", cmd.cmd stdin.printf "retall\n" stdin.printf "printf, -2, '%s'\n", cmd.end_err stdin.printf "printf, -1, '%s'\n", cmd.end_out stdin.flush end |