Sha256: c96c03fc304a20308fc3b065cff402e6ab6eb2898c8ea20b0170310b073cb9be

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 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)

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

      end
    end

  end # Cursors

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.4.26 lib/vedeu/repositories/repositories/cursors.rb