Sha256: b2b27e6036f6ef307b2be71af3ecbe72fb44af17a891024981e15dbcada10a22

Contents?: true

Size: 979 Bytes

Versions: 7

Compression:

Stored size: 979 Bytes

Contents

module Vedeu

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

    class << self

      # @example
      #   Vedeu.cursors
      #
      # @return [Vedeu::Cursors]
      alias_method :cursors, :repository

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

      # Remove all stored models from the repository.
      #
      # @example
      #   Vedeu.cursors.reset
      #
      # @return [Vedeu::Cursors]
      def reset!
        @cursors = register(Vedeu::Cursor)
      end

    end

    # @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

      end
    end

  end # Cursors

end # Vedeu

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vedeu-0.4.40 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.39 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.38 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.37 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.36 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.35 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.34 lib/vedeu/repositories/repositories/cursors.rb