Class: Session::IDL
- Inherits:
-
AbstractSession
- Object
- AbstractSession
- Session::IDL
- Defined in:
- lib/session.rb,
lib/session-2.4.0.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.
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 |
# File 'lib/session.rb', line 633 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
–}}}
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 |
# File 'lib/session.rb', line 651 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
–}}}
679 680 681 682 683 684 |
# File 'lib/session.rb', line 679 def path #--{{{ stdout, stderr = execute "print, !path" stdout.strip.split %r/:/o #--}}} end |
#path=(arg) ⇒ Object
–}}}
685 686 687 688 689 690 691 692 693 694 695 696 697 |
# File 'lib/session.rb', line 685 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
–}}}
666 667 668 669 670 671 672 673 674 675 676 677 678 |
# File 'lib/session.rb', line 666 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 |