Class: Racf::Session
- Inherits:
-
Object
- Object
- Racf::Session
- Defined in:
- lib/racf/session.rb
Constant Summary collapse
- DEFAULT_SERVER_PORT =
23
- DEFAULT_SCRIPT_PORT =
'7060'
Instance Attribute Summary collapse
-
#last_error_message ⇒ Object
readonly
Returns the value of attribute last_error_message.
Instance Method Summary collapse
-
#finish ⇒ Object
Go out of ISPF shell and logoff from mainframe.
-
#initialize(options) ⇒ Session
constructor
A new instance of Session.
-
#remove_ispf_menu(screen) ⇒ Object
TODO Remove from the public API.
-
#run_command(command) ⇒ Object
Runs a RACF command and returns its raw output.
-
#start ⇒ Object
Start a ISPF shell session.
Constructor Details
#initialize(options) ⇒ Session
Returns a new instance of Session.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/racf/session.rb', line 13 def initialize() @user_id = [:user_id] @password = [:password] @server_address = [:server_address] @verbose = [:verbose] @telnet_timeout = [:telnet_timeout] @server_port = [:server_port] || DEFAULT_SERVER_PORT @script_port = [:script_port] || DEFAULT_SCRIPT_PORT @scraper = [:scraper] || default_scraper end |
Instance Attribute Details
#last_error_message ⇒ Object (readonly)
Returns the value of attribute last_error_message.
11 12 13 |
# File 'lib/racf/session.rb', line 11 def @last_error_message end |
Instance Method Details
#finish ⇒ Object
Go out of ISPF shell and logoff from mainframe
35 36 37 38 39 40 41 42 |
# File 'lib/racf/session.rb', line 35 def finish Racf.logger.info("Closing RACF session") @scraper.action("pf 3") @scraper.string_action("X") @scraper.string_action("logoff") @scraper.close # a action quit faz o emulador dar exit Racf.logger.info("RACF session closed") end |
#remove_ispf_menu(screen) ⇒ Object
TODO Remove from the public API. In order to do it, it’s neeeded to improve the design. #theClientIsPushingUs
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/racf/session.rb', line 62 def (screen) if screen.lines.first =~ /Menu\s+List\s+Mode\s+Functions\s+Utilities\s+Help/ screen = screen.drop(8) screen = screen.drop_while { |line| line.match(/.*?=>.*?$/) } end screen = screen.to_s if screen =~ /Menu\s+List\s+Mode\s+Functions\s+Utilities\s+Help/ screen.gsub!(/Menu\s+List\s+Mode\s+Functions\s+Utilities\s+Help.*/m, '') end screen.strip! screen end |
#run_command(command) ⇒ Object
Runs a RACF command and returns its raw output
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/racf/session.rb', line 46 def run_command(command) Racf.logger.info("Executing RACF '#{command}'") @scraper.string_action(command) raw_response = @scraper.complete_screen @scraper.action("enter") Racf.logger.info("Finished executing RACF '#{command}'") = (raw_response) end |