Sha256: 6b559789dc2d068339599f05917134914ae372818ead298abff3794dd0d7b189
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
module Vedeu # Provides the mechanism to arbitrarily move a cursor to a given position. # # @api private class Reposition # @return [Vedeu::Cursor] # @see Vedeu::Reposition.new def self.to(entity, name, y, x) new(entity, name, y, x).to end # @param entity [] # @param name [String] # @param y [Fixnum] # @param x [Fixnum] # @return [Vedeu::Reposition] def initialize(entity, name, y, x) @entity = entity @name = name @y = y @x = x end # @return [Vedeu::Cursor] def to result = entity.new(name: name, y: y_position, x: x_position, oy: y, ox: x).store Vedeu.trigger(:_clear_, name) Vedeu.trigger(:_refresh_, name) Vedeu.trigger(:_refresh_cursor_, name) result end protected # @!attribute [r] entity # @return [String] attr_reader :entity # @!attribute [r] name # @return [String] attr_reader :name # @!attribute [r] x # @return [Fixnum] attr_reader :x # @!attribute [r] y # @return [Fixnum] attr_reader :y private # @return [Coordinate] def coordinate @coordinate ||= Vedeu::Coordinate.new(name) end # Returns the cursors x position based on the desired x position. # # @return [Fixnum] def x_position coordinate.x_position(x) end # Returns the cursors y position based on the desired y position. # # @return [Fixnum] def y_position coordinate.y_position(y) end end # Reposition end # Vedeu
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.4.40 | lib/vedeu/cursor/reposition.rb |