Class: TestaAppiumDriver::Offset

Inherits:
Object
  • Object
show all
Defined in:
lib/testa_appium_driver/common/bounds.rb

Instance Method Summary collapse

Constructor Details

#initialize(bounds, window_width, window_height) ⇒ Offset

Returns a new instance of Offset.



114
115
116
117
118
119
# File 'lib/testa_appium_driver/common/bounds.rb', line 114

def initialize(bounds, window_width, window_height)
  @top = bounds.top_left.y
  @right = window_width - bounds.bottom_right.x
  @bottom = window_height - bounds.bottom_right.y
  @left = bounds.top_left.x
end

Instance Method Details

#as_jsonObject



121
122
123
124
125
126
127
128
# File 'lib/testa_appium_driver/common/bounds.rb', line 121

def as_json
  {
    top: @top,
    right: @right,
    bottom: @bottom,
    left: @left
  }
end

#bottomInteger

Returns:

  • (Integer)


141
142
143
# File 'lib/testa_appium_driver/common/bounds.rb', line 141

def bottom
  @bottom
end

#leftInteger

Returns:

  • (Integer)


146
147
148
# File 'lib/testa_appium_driver/common/bounds.rb', line 146

def left
  @left
end

#rightInteger

Returns:

  • (Integer)


136
137
138
# File 'lib/testa_appium_driver/common/bounds.rb', line 136

def right
  @right
end

#topInteger

Returns:

  • (Integer)


131
132
133
# File 'lib/testa_appium_driver/common/bounds.rb', line 131

def top
  @top
end