Sha256: c40523ad13c0ac061e5fb843153bd8db8d783e0a17242786e05ab932e75cd205

Contents?: true

Size: 889 Bytes

Versions: 1

Compression:

Stored size: 889 Bytes

Contents

module Vedeu

  # Repository for storing and retrieving content offsets; i.e. scroll
  # position for a named interface.
  #
  # @api private
  module Offsets

    include Common
    include Repository
    extend self

    # Add or update the offset coordinates for interface content.
    #
    # @param attributes [Hash]
    # @return [Offset]
    def add(attributes)
      validate_attributes!(attributes)

      Vedeu.log("#{action(__callee__)} offset: '#{attributes[:name]}'")

      storage.store(attributes[:name], Offset.new(attributes))
    end
    alias_method :update, :add

    # @param y [Fixnum]
    # @param x [Fixnum]
    # @return [Offset]
    def move(y, x)
      find_or_create(Focus.current).move(y, x)
    end

    private

    # @return [Class]
    def entity
      Offset
    end

    # @return [Hash]
    def in_memory
      {}
    end

  end # Offsets

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.2.4 lib/vedeu/repositories/offsets.rb