Module: TE3270
- Extended by:
- FunctionKeys
- Includes:
- ScreenPopulator
- 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/emulators/x3270.rb,
lib/te3270/emulator_factory.rb,
lib/te3270/emulators/virtel.rb,
lib/te3270/screen_populator.rb,
lib/te3270/emulators/bluezone.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 supported emulators are EXTRA! X-treme by Attachmate, Quick3270 by DN-Computing, Virtel Web Access and X3270. These are commercial products, with the exception of X3270, 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, ScreenPopulator
Constant Summary collapse
- VERSION =
"0.9.0"
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.
Methods included from ScreenPopulator
Class Method Details
.disconnect(emulator) ⇒ Object
Disconnects and closes the emulator
82 83 84 |
# File 'lib/te3270.rb', line 82 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.
for Virtel Web access, and :x3270 for X3270
72 73 74 75 76 77 |
# File 'lib/te3270.rb', line 72 def self.emulator_for(platform, &block) platform_class = TE3270::EmulatorFactory.emulator_for(platform) @platform = platform_class.new @platform.connect &block @platform end |
.included(cls) ⇒ Object
59 60 61 |
# File 'lib/te3270.rb', line 59 def self.included(cls) cls.extend TE3270::Accessors 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.
96 97 98 |
# File 'lib/te3270.rb', line 96 def connect platform.connect end |
#disconnect ⇒ Object
Disconnect from platform (extra or quick)
103 104 105 |
# File 'lib/te3270.rb', line 103 def disconnect platform.disconnect end |
#initialize(platform) ⇒ Object
86 87 88 89 |
# File 'lib/te3270.rb', line 86 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.
128 129 130 |
# File 'lib/te3270.rb', line 128 def screenshot(filename) platform.screenshot(filename) end |
#send_keys(keys) ⇒ Object
Send keys on the emulator
110 111 112 |
# File 'lib/te3270.rb', line 110 def send_keys(keys) platform.send_keys(keys) end |
#text ⇒ Object
Retrieves the text from the current screen
117 118 119 |
# File 'lib/te3270.rb', line 117 def text platform.text end |
#wait_for_host(seconds = 5) ⇒ Object
Waits for the host for specified # of seconds. Default is 5 seconds
148 149 150 |
# File 'lib/te3270.rb', line 148 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
139 140 141 |
# File 'lib/te3270.rb', line 139 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
158 159 160 |
# File 'lib/te3270.rb', line 158 def wait_until_cursor_at(row, column) platform.wait_until_cursor_at(row, column) end |