lib/vedeu/cursors/cursor.rb in vedeu-0.6.7 vs lib/vedeu/cursors/cursor.rb in vedeu-0.6.8

- old
+ new

@@ -1,11 +1,11 @@ module Vedeu module Cursors - # Each interface has its own Cursor which maintains the position and - # visibility of the cursor within that interface. + # Each interface has its own Cursor which maintains the position + # and visibility of the cursor within that interface. # class Cursor include Vedeu::Model include Vedeu::Toggleable @@ -46,18 +46,21 @@ attr_writer :y # Returns a new instance of Vedeu::Cursors::Cursor. # # @param attributes [Hash] - # @option attributes name [String] The name of the interface this cursor - # belongs to. + # @option attributes name [String] The name of the interface + # this cursor belongs to. # @option attributes ox [Fixnum] The offset x coordinate. # @option attributes oy [Fixnum] The offset y coordinate. # @option attributes repository [Vedeu::Repository] - # @option attributes visible [Boolean] The visibility of the cursor. - # @option attributes x [Fixnum] The terminal x coordinate for the cursor. - # @option attributes y [Fixnum] The terminal y coordinate for the cursor. + # @option attributes visible [Boolean] The visibility of the + # cursor. + # @option attributes x [Fixnum] The terminal x coordinate for + # the cursor. + # @option attributes y [Fixnum] The terminal y coordinate for + # the cursor. # # @return [Vedeu::Cursors::Cursor] def initialize(attributes = {}) @attributes = defaults.merge!(attributes) @@ -131,11 +134,11 @@ Vedeu::Cursors::Cursor.new(@attributes).store end # Renders the cursor. # - # @return [Array<Vedeu::Escape>] + # @return [Array<Vedeu::Models::Escape>] def render Vedeu::Output.render(visibility) end # Arbitrarily move the cursor to a given position. @@ -151,12 +154,12 @@ Vedeu::Cursors::Cursor.new(@attributes).store end # Returns an escape sequence to position the cursor and set its - # visibility. When passed a block, will position the cursor, yield and - # return the original position. + # visibility. When passed a block, will position the cursor, + # yield and return the original position. # # @return [String] def to_s if block_given? "#{position}#{yield}#{visibility}" @@ -166,17 +169,18 @@ end end alias_method :to_str, :to_s - # Hide a named cursor, or without a name, the cursor of the currently + # Hide a named cursor, or without a name, the cursor of the + # currently # focussed interface. # # @example # Vedeu.hide_cursor(name) # - # @return [Vedeu::Escape] + # @return [Vedeu::Models::Escape] def hide super render end @@ -198,17 +202,17 @@ # @return [Vedeu::Geometry::Position] def position @position = Vedeu::Geometry::Position[y, x] end - # Show a named cursor, or without a name, the cursor of the currently - # focussed interface. + # Show a named cursor, or without a name, the cursor of the + # currently focussed interface. # # @example # Vedeu.show_cursor(name) # - # @return [Vedeu::Escape] + # @return [Vedeu::Models::Escape] def show super render end @@ -216,11 +220,11 @@ # Toggle the visibility of the cursor with the given name. # # @example # Vedeu.toggle_cursor(name) # - # @return [Vedeu::Escape] + # @return [Vedeu::Models::Escape] def toggle if visible? hide else @@ -274,16 +278,17 @@ x: 1, y: 1, } end - # Returns the escape sequence for setting the visibility of the cursor. + # Returns the escape sequence for setting the visibility of the + # cursor. # # @return [String] def visibility value = visible? ? Vedeu::Esc.show_cursor : Vedeu::Esc.hide_cursor - Vedeu::Escape.new(position: position, value: value) + Vedeu::Models::Escape.new(position: position, value: value) end end # Cursor end # Cursors