Class: Mindee::Geometry::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/geometry/point.rb

Overview

A relative set of coordinates (X, Y) on the document.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y) ⇒ Point

Returns a new instance of Point.

Parameters:

  • x (Float)
  • y (Float)


17
18
19
20
# File 'lib/mindee/geometry/point.rb', line 17

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

Instance Attribute Details

#xFloat

Returns:

  • (Float)


9
10
11
# File 'lib/mindee/geometry/point.rb', line 9

def x
  @x
end

#yFloat

Returns:

  • (Float)


11
12
13
# File 'lib/mindee/geometry/point.rb', line 11

def y
  @y
end

Instance Method Details

#[](key) ⇒ Float

Returns:

  • (Float)


24
25
26
27
28
29
30
31
32
33
# File 'lib/mindee/geometry/point.rb', line 24

def [](key)
  case key
  when 0
    @x
  when 1
    @y
  else
    throw '0 or 1 only'
  end
end