Class: Subconv::Position
- Inherits:
-
Object
- Object
- Subconv::Position
- 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
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(x, y) ⇒ Position
constructor
A new instance of Position.
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
#x ⇒ Object
Returns the value of attribute x.
16 17 18 |
# File 'lib/subconv/caption.rb', line 16 def x @x end |
#y ⇒ Object
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 |