Method: Rtml::Test::Screen#possible_variants

Defined in:
lib/rtml/test/screen.rb

#possible_variantsObject

Returns an array of Hashes representing all possible non-user interaction-requiring variants from this screen. These are returned regardless of whether user interation is required at this time.

The hashes are laid out thusly:

{ :uri => "destination_uri", :key => "hotkey", :timeout => "seconds", :lo => "left_operand",
  :op => "operation", :ro => "right_operand" }

Note that some of these keys may be omitted, according to the TML rules for the variant element.

For TML next elements, all keys except :uri are omitted.



111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/rtml/test/screen.rb', line 111

def possible_variants
  variants = ((@screen / "variant") || []).collect do |variant|
    { :uri => variant['uri'], :key => variant['key'], :timeout => variant['timeout'],
      :lo  => variant['lo'],  :op  => variant['op'],  :ro      => variant['ro'] }.optionalize
  end
  if !(nxt = (@screen / "next") || []).empty?
    variants << { :uri => nxt.first['uri'] }
  else
    variants << { :uri => @screen['next'] }
  end
  variants
end