lib/vedeu/geometry/coordinate.rb in vedeu-0.6.4 vs lib/vedeu/geometry/coordinate.rb in vedeu-0.6.5

- old
+ new

@@ -1,49 +1,71 @@ module Vedeu - # Crudely corrects out of range values. - # - class Coordinate + module Geometry - extend Forwardable + # Crudely corrects out of range values. + # + class Coordinate - def_delegators :x, - :x_position, - :xn + extend Forwardable - def_delegators :y, - :y_position, - :yn + def_delegators :x, + :x_position, + :xn - # Returns a new instance of Vedeu::Coordinate. - # - # @param name [String] - # @param oy [Fixnum] - # @param ox [Fixnum] - # @return [Vedeu::Coordinate] - def initialize(name, oy, ox) - @name = name - @ox = ox - @oy = oy - end + def_delegators :y, + :y_position, + :yn - private + # Returns a new instance of Vedeu::Geometry::Coordinate. + # + # @param name [String] + # @param oy [Fixnum] + # @param ox [Fixnum] + # @return [Vedeu::Geometry::Coordinate] + def initialize(name, oy, ox) + @name = name + @ox = ox + @oy = oy + end - # Provide an instance of Vedeu::GenericCoordinate to determine correct x - # related coordinates. - # - # @return [Vedeu::GenericCoordinate] - def x - @x ||= Vedeu::GenericCoordinate.new(name: @name, offset: @ox, type: :x) - end + protected - # Provide an instance of Vedeu::GenericCoordinate to determine correct y - # related coordinates. - # - # @return [Vedeu::GenericCoordinate] - def y - @y ||= Vedeu::GenericCoordinate.new(name: @name, offset: @oy, type: :y) - end + # @!attribute [r] name + # @return [String] + attr_reader :name - end # Coordinate + # @!attribute [rw] ox + # @return [Fixnum] + attr_accessor :ox + + # @!attribute [rw] oy + # @return [Fixnum] + attr_accessor :oy + + private + + # Provide an instance of Vedeu::Geometry::GenericCoordinate to determine + # correct x related coordinates. + # + # @return [Vedeu::Geometry::GenericCoordinate] + def x + @x ||= Vedeu::Geometry::GenericCoordinate.new(name: name, + offset: ox, + type: :x) + end + + # Provide an instance of Vedeu::Geometry::GenericCoordinate to determine + # correct y related coordinates. + # + # @return [Vedeu::Geometry::GenericCoordinate] + def y + @y ||= Vedeu::Geometry::GenericCoordinate.new(name: name, + offset: oy, + type: :y) + end + + end # Coordinate + + end # Geometry end # Vedeu