Class: OnlyofficeWebdriverWrapper::Dimensions
- Inherits:
-
Object
- Object
- OnlyofficeWebdriverWrapper::Dimensions
- Defined in:
- lib/onlyoffice_webdriver_wrapper/dimensions.rb
Overview
Class for working with cursor coordinates
Instance Attribute Summary collapse
-
#left ⇒ Object
(also: #width, #x)
Returns the value of attribute left.
-
#top ⇒ Object
(also: #height, #y)
Returns the value of attribute top.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compare two dimensions object.
-
#center ⇒ Dimensions
Center point of current dimension.
-
#initialize(left, top) ⇒ Dimensions
constructor
A new instance of Dimensions.
-
#to_s ⇒ String
String representation of Dimensions.
Constructor Details
#initialize(left, top) ⇒ Dimensions
Returns a new instance of Dimensions.
8 9 10 11 |
# File 'lib/onlyoffice_webdriver_wrapper/dimensions.rb', line 8 def initialize(left, top) @left = left @top = top end |
Instance Attribute Details
#left ⇒ Object Also known as: width, x
Returns the value of attribute left.
6 7 8 |
# File 'lib/onlyoffice_webdriver_wrapper/dimensions.rb', line 6 def left @left end |
#top ⇒ Object Also known as: height, y
Returns the value of attribute top.
6 7 8 |
# File 'lib/onlyoffice_webdriver_wrapper/dimensions.rb', line 6 def top @top end |
Instance Method Details
#==(other) ⇒ Boolean
Compare two dimensions object
16 17 18 19 20 |
# File 'lib/onlyoffice_webdriver_wrapper/dimensions.rb', line 16 def ==(other) return false unless other.respond_to?(:left) && other.respond_to?(:top) @left == other.left && @top == other.top end |
#center ⇒ Dimensions
Returns Center point of current dimension.
33 34 35 |
# File 'lib/onlyoffice_webdriver_wrapper/dimensions.rb', line 33 def center Dimensions.new(@left / 2, @top / 2) end |
#to_s ⇒ String
Returns String representation of Dimensions.
28 29 30 |
# File 'lib/onlyoffice_webdriver_wrapper/dimensions.rb', line 28 def to_s "Dimensions(left: #{@left}, top: #{@top})" end |