Class: TansParser::Element
- Inherits:
-
Struct
- Object
- Struct
- TansParser::Element
- Defined in:
- lib/tans_parser/element.rb
Overview
Describes a recognized UI element on the terminal screen.
Instance Attribute Summary collapse
-
#bg ⇒ Object
Returns the value of attribute bg.
-
#checked ⇒ Object
Returns the value of attribute checked.
-
#col ⇒ Object
Returns the value of attribute col.
-
#disabled ⇒ Object
Returns the value of attribute disabled.
-
#fg ⇒ Object
Returns the value of attribute fg.
-
#focused ⇒ Object
Returns the value of attribute focused.
-
#height ⇒ Object
Returns the value of attribute height.
-
#role ⇒ Object
Returns the value of attribute role.
-
#row ⇒ Object
Returns the value of attribute row.
-
#text ⇒ Object
Returns the value of attribute text.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
- #bounds ⇒ Object
- #checked? ⇒ Boolean
- #click ⇒ Object
- #disabled? ⇒ Boolean
- #press_key(key) ⇒ Object
- #to_h ⇒ Object
- #type(text) ⇒ Object
Instance Attribute Details
#bg ⇒ Object
Returns the value of attribute bg
5 6 7 |
# File 'lib/tans_parser/element.rb', line 5 def bg @bg end |
#checked ⇒ Object
Returns the value of attribute checked
5 6 7 |
# File 'lib/tans_parser/element.rb', line 5 def checked @checked end |
#col ⇒ Object
Returns the value of attribute col
5 6 7 |
# File 'lib/tans_parser/element.rb', line 5 def col @col end |
#disabled ⇒ Object
Returns the value of attribute disabled
5 6 7 |
# File 'lib/tans_parser/element.rb', line 5 def disabled @disabled end |
#fg ⇒ Object
Returns the value of attribute fg
5 6 7 |
# File 'lib/tans_parser/element.rb', line 5 def fg @fg end |
#focused ⇒ Object
Returns the value of attribute focused
5 6 7 |
# File 'lib/tans_parser/element.rb', line 5 def focused @focused end |
#height ⇒ Object
Returns the value of attribute height
5 6 7 |
# File 'lib/tans_parser/element.rb', line 5 def height @height end |
#role ⇒ Object
Returns the value of attribute role
5 6 7 |
# File 'lib/tans_parser/element.rb', line 5 def role @role end |
#row ⇒ Object
Returns the value of attribute row
5 6 7 |
# File 'lib/tans_parser/element.rb', line 5 def row @row end |
#text ⇒ Object
Returns the value of attribute text
5 6 7 |
# File 'lib/tans_parser/element.rb', line 5 def text @text end |
#width ⇒ Object
Returns the value of attribute width
5 6 7 |
# File 'lib/tans_parser/element.rb', line 5 def width @width end |
Instance Method Details
#bounds ⇒ Object
24 25 26 |
# File 'lib/tans_parser/element.rb', line 24 def bounds { row: row, col: col, width: width, height: height } end |
#checked? ⇒ Boolean
16 17 18 |
# File 'lib/tans_parser/element.rb', line 16 def checked? !!checked end |
#click ⇒ Object
28 29 30 |
# File 'lib/tans_parser/element.rb', line 28 def click { action: :click, target: self, row: row, col: col + (width / 2) } end |
#disabled? ⇒ Boolean
20 21 22 |
# File 'lib/tans_parser/element.rb', line 20 def disabled? !!disabled end |
#press_key(key) ⇒ Object
36 37 38 |
# File 'lib/tans_parser/element.rb', line 36 def press_key(key) { action: :press_key, target: self, key: key } end |
#to_h ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/tans_parser/element.rb', line 40 def to_h { role: role, text: text, row: row, col: col, width: width, height: height, checked: checked, focused: focused, fg: fg, bg: bg, disabled: disabled, }.compact end |
#type(text) ⇒ Object
32 33 34 |
# File 'lib/tans_parser/element.rb', line 32 def type(text) { action: :type, target: self, row: row, col: col + (width / 2), text: text } end |