Module: TE3270
- Extended by:
- FunctionKeys
- Defined in:
- lib/te3270.rb,
lib/te3270/version.rb,
lib/te3270/accessors.rb,
lib/te3270/function_keys.rb,
lib/te3270/screen_factory.rb,
lib/te3270/emulators/extra.rb,
lib/te3270/emulator_factory.rb,
lib/te3270/emulators/quick3270.rb
Overview
This gem can be used to drive a 3270 terminal emulator. You have to have a supported emulator installed on the machines on which you use the gem. Currently the only supported emulators are EXTRA! X-treme by Attachmate and Quick3270 by DN-Computing. These are commercial products and you will need to purchase one of them in order to use this gem. We do plan to support other emulators as time permits.
This gem has been designed to work very similar to the page-object gem. You will use it to create screen objects for each screen in your application. Here is an example of one and how it can be used:
Another option is to mixin the TE3270::ScreenFactory
module on use the factory methods to create the screen objects. If you are using Cucumber you can do this by calling the World
method in your env.rb file. Then you can use the factory and navigation methods in your step definitions.
Defined Under Namespace
Modules: Accessors, EmulatorFactory, Emulators, FunctionKeys, ScreenFactory
Constant Summary collapse
- VERSION =
"0.1"
Constants included from FunctionKeys
Class Method Summary collapse
-
.disconnect(emulator) ⇒ Object
Disconnects and closes the emulator.
-
.emulator_for(platform, &block) ⇒ Object
Starts the terminal emulator and makes the connection.
- .included(cls) ⇒ Object
Instance Method Summary collapse
-
#connect ⇒ Object
Open a new screen and connect to the host.
-
#disconnect ⇒ Object
Disconnect from platform (extra or quick).
- #initialize(platform) ⇒ Object
-
#screenshot(filename) ⇒ Object
Takes screenshot and saves to the filename specified.
-
#send_keys(keys) ⇒ Object
Send keys on the emulator.
-
#text ⇒ Object
Retrieves the text from the current screen.
-
#wait_for_host(seconds = 5) ⇒ Object
Waits for the host for specified # of seconds.
-
#wait_for_string(str, row, column) ⇒ Object
Waits for the string to appear at the specified location.
-
#wait_until_cursor_at(row, column) ⇒ Object
Waits for the cursor to appear at the specified location.
Class Method Details
.disconnect(emulator) ⇒ Object
Disconnects and closes the emulator
80 81 82 |
# File 'lib/te3270.rb', line 80 def self.disconnect(emulator) emulator.disconnect end |
.emulator_for(platform, &block) ⇒ Object
Starts the terminal emulator and makes the connection. This method requires a block that has emulator specific information that is necessary to complete the connection. To know what information you should provide in the block please see the classes in the TE3270::Emulators package.
70 71 72 73 74 75 |
# File 'lib/te3270.rb', line 70 def self.emulator_for(platform, &block) platform_class = TE3270::EmulatorFactory.emulator_for(platform) @platform = platform_class.new @platform.connect &block @platform end |
Instance Method Details
#connect ⇒ Object
Open a new screen and connect to the host. Platform specific values are set by passing a block to this method. To see the valid platform specific values please read the documentation for your emulator class in the TE3270::Emulators module.
94 95 96 |
# File 'lib/te3270.rb', line 94 def connect platform.connect end |
#disconnect ⇒ Object
Disconnect from platform (extra or quick)
101 102 103 |
# File 'lib/te3270.rb', line 101 def disconnect platform.disconnect end |
#initialize(platform) ⇒ Object
84 85 86 87 |
# File 'lib/te3270.rb', line 84 def initialize(platform) @platform = platform initialize_screen if respond_to? :initialize_screen end |
#screenshot(filename) ⇒ Object
Takes screenshot and saves to the filename specified. If you have visibility set to false then this method will first of all make the screen visible, take the screenshot, and then make set visibility to false again.
126 127 128 |
# File 'lib/te3270.rb', line 126 def screenshot(filename) platform.screenshot(filename) end |
#send_keys(keys) ⇒ Object
Send keys on the emulator
108 109 110 |
# File 'lib/te3270.rb', line 108 def send_keys(keys) platform.send_keys(keys) end |
#text ⇒ Object
Retrieves the text from the current screen
115 116 117 |
# File 'lib/te3270.rb', line 115 def text platform.text end |
#wait_for_host(seconds = 5) ⇒ Object
Waits for the host for specified # of seconds. Default is 5 seconds
146 147 148 |
# File 'lib/te3270.rb', line 146 def wait_for_host(seconds=5) platform.wait_for_host(seconds) end |
#wait_for_string(str, row, column) ⇒ Object
Waits for the string to appear at the specified location
137 138 139 |
# File 'lib/te3270.rb', line 137 def wait_for_string(str, row, column) platform.wait_for_string(str, row, column) end |
#wait_until_cursor_at(row, column) ⇒ Object
Waits for the cursor to appear at the specified location
156 157 158 |
# File 'lib/te3270.rb', line 156 def wait_until_cursor_at(row, column) platform.wait_until_cursor_at(row, column) end |