Sha256: 8d265909f797a2a31b4fb1ef51bd9db00473cc81212a5bf28a964bb54163251d

Contents?: true

Size: 743 Bytes

Versions: 6

Compression:

Stored size: 743 Bytes

Contents

module Vedeu

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

    class << self

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

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

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

    end

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

6 entries across 6 versions & 1 rubygems

Version Path
vedeu-0.4.32 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.31 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.30 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.29 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.28 lib/vedeu/repositories/repositories/cursors.rb
vedeu-0.4.27 lib/vedeu/repositories/repositories/cursors.rb