Class: PDF::Reader::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/pdf/reader/point.rb

Overview

PDFs are all about positioning content on a page, so there’s lots of need to work with a set of X,Y coordinates.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y) ⇒ Point

Returns a new instance of Point.



15
16
17
# File 'lib/pdf/reader/point.rb', line 15

def initialize(x, y)
  @x, @y = x, y
end

Instance Attribute Details

#xObject (readonly)

Returns the value of attribute x.



13
14
15
# File 'lib/pdf/reader/point.rb', line 13

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



13
14
15
# File 'lib/pdf/reader/point.rb', line 13

def y
  @y
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
# File 'lib/pdf/reader/point.rb', line 19

def ==(other)
  other.respond_to?(:x) && other.respond_to?(:y) && x == other.x && y == other.y
end