Class: Subconv::Position

Inherits:
Object
  • Object
show all
Defined in:
lib/subconv/caption.rb

Overview

Two-dimensional screen position relative (both x and y position between 0 and 1) to the screen size

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y) ⇒ Position

Returns a new instance of Position.



6
7
8
9
# File 'lib/subconv/caption.rb', line 6

def initialize(x, y)
  self.x = x
  self.y = y
end

Instance Attribute Details

#xObject

Returns the value of attribute x.



16
17
18
# File 'lib/subconv/caption.rb', line 16

def x
  @x
end

#yObject

Returns the value of attribute y.



16
17
18
# File 'lib/subconv/caption.rb', line 16

def y
  @y
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
14
# File 'lib/subconv/caption.rb', line 11

def ==(other)
  # Ignore small differences in the position
  self.class == other.class && (@x - other.x).abs < 0.01 && (@y - other.y).abs < 0.01
end