Class: Applitools::Region

Inherits:
Object
  • Object
show all
Defined in:
lib/eyes_selenium_ruby/eyes/region.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, top, height, width) ⇒ Region

Returns a new instance of Region.



4
5
6
7
8
9
# File 'lib/eyes_selenium_ruby/eyes/region.rb', line 4

def initialize(left, top, height, width)
  @left = left
  @top = top
  @height = height
  @width = width
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



2
3
4
# File 'lib/eyes_selenium_ruby/eyes/region.rb', line 2

def height
  @height
end

#leftObject

Returns the value of attribute left.



2
3
4
# File 'lib/eyes_selenium_ruby/eyes/region.rb', line 2

def left
  @left
end

#topObject

Returns the value of attribute top.



2
3
4
# File 'lib/eyes_selenium_ruby/eyes/region.rb', line 2

def top
  @top
end

#widthObject

Returns the value of attribute width.



2
3
4
# File 'lib/eyes_selenium_ruby/eyes/region.rb', line 2

def width
  @width
end

Instance Method Details

#middle_offsetObject



11
12
13
14
15
# File 'lib/eyes_selenium_ruby/eyes/region.rb', line 11

def middle_offset
  mid_x = width / 2
  mid_y = height / 2
  Selenium::WebDriver::Location.new mid_x, mid_y
end

#to_hashObject



17
18
19
20
21
# File 'lib/eyes_selenium_ruby/eyes/region.rb', line 17

def to_hash
  {
    "$type" => "Applitools.Utils.Geometry.MutableRegion, Core", left: left, top: top, height: height, width: width
  }
end