Module: TE3270::ScreenPopulator

Included in:
TE3270
Defined in:
lib/te3270/screen_populator.rb

Instance Method Summary collapse

Instance Method Details

#populate_screen_with(hsh) ⇒ Object

This method will populate all matched screen text fields from the Hash passed as an argument. The way it find an element is by matching the Hash key to the name you provided when declaring the text field on your screen.

Examples:

class ExampleScreen
  include TE3270

  text_field(:username, 1, 2, 20)
end

...

@emulator = TE3270::emulator_for :quick3270
example_screen = ExampleScreen.new(@emulator)
example_screen.populate_screen_with :username => 'a name'

Parameters:

  • hsh (Hash)

    the data to use to populate this screen.



26
27
28
29
30
# File 'lib/te3270/screen_populator.rb', line 26

def populate_screen_with(hsh)
  hsh.each do |key, value|
    self.send("#{key}=", value) if self.respond_to? "#{key}=".to_sym
  end
end