Sha256: 8cae59602a5b313952c038f0cabe0a5c40c4bc94d62eda70d5bf18ed34fe9555

Contents?: true

Size: 790 Bytes

Versions: 7

Compression:

Stored size: 790 Bytes

Contents

require 'vedeu/cursor/cursor'

module Vedeu

  # Allows the storing of each interface's cursor.
  #
  # @api public
  class Cursors < Repository

    class << self

      alias_method :cursors, :repository

      # @return [Vedeu::Cursor]
      # @see Vedeu::API.cursor
      def cursor
        cursors.by_name(Vedeu.focus) if Vedeu.focus
      end

    end # Eigenclass

    real Vedeu::Cursor

    # @example
    #   Vedeu.cursors.by_name('some_name')
    #
    # @param name [String] The name of the stored cursor.
    # @return [Vedeu::Cursor]
    def by_name(name)
      if registered?(name)
        find(name)

      elsif name
        Vedeu::Cursor.new(name: name).store

      else
        Vedeu::Cursor.new(name: Vedeu.focus).store

      end
    end

  end # Cursors

end # Vedeu

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vedeu-0.4.53 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.52 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.51 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.50 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.49 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.48 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.47 lib/vedeu/repositories/repositories/cursors.rb