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

: (Numeric, Numeric) -> void



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

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

Instance Attribute Details

#xObject (readonly)

: Numeric



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

def x
  @x
end

#yObject (readonly)

: Numeric



17
18
19
# File 'lib/pdf/reader/point.rb', line 17

def y
  @y
end

Instance Method Details

#==(other) ⇒ Object

: (PDF::Reader::Point) -> bool



26
27
28
# File 'lib/pdf/reader/point.rb', line 26

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