Class: OnlyofficePdfParser::CursorPoint
- Inherits:
-
Object
- Object
- OnlyofficePdfParser::CursorPoint
- Defined in:
- lib/onlyoffice_pdf_parser/helpers/cursor_point.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) ⇒ True, False
Compare object with other.
-
#[](name) ⇒ Object
Accessor of attributes like hash.
-
#dup ⇒ CursorPoint
Make a copy of object.
-
#initialize(left, top) ⇒ CursorPoint
constructor
A new instance of CursorPoint.
-
#to_s ⇒ String
Convert object to string.
Constructor Details
#initialize(left, top) ⇒ CursorPoint
Returns a new instance of CursorPoint.
8 9 10 11 |
# File 'lib/onlyoffice_pdf_parser/helpers/cursor_point.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_pdf_parser/helpers/cursor_point.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_pdf_parser/helpers/cursor_point.rb', line 6 def top @top end |
Instance Method Details
#==(other) ⇒ True, False
Compare object with other
32 33 34 35 36 37 38 |
# File 'lib/onlyoffice_pdf_parser/helpers/cursor_point.rb', line 32 def ==(other) if other.respond_to?(:left) && other.respond_to?(:top) @left == other.left && @top == other.top else false end end |
#[](name) ⇒ Object
Accessor of attributes like hash
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/onlyoffice_pdf_parser/helpers/cursor_point.rb', line 43 def [](name) case name when :width left when :height top else 'Unknown attribute' end end |
#dup ⇒ CursorPoint
Make a copy of object
20 21 22 |
# File 'lib/onlyoffice_pdf_parser/helpers/cursor_point.rb', line 20 def dup CursorPoint.new(@left, @top) end |
#to_s ⇒ String
Returns convert object to string.
25 26 27 |
# File 'lib/onlyoffice_pdf_parser/helpers/cursor_point.rb', line 25 def to_s "[#{@left}, #{@top}]" end |