Sha256: 4ca083067bc9e5bdf7ec885316c14a26420d6f82262d53d4b6e0c31dc892080f

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Vedeu

  module Buffers

    # Refreshes the given named interface.
    #
    # @api private
    #
    class Refresh

      include Vedeu::Common

      # {include:file:docs/events/by_name/refresh_view.md}
      # @param (see #initialize)
      # @return (see #by_name)
      def self.by_name(name = Vedeu.focus)
        new(name).by_name
      end

      # Return a new instance of Vedeu::Buffers::Refresh.
      #
      # @macro param_name
      # @return [Vedeu::Buffers::Refresh]
      def initialize(name = Vedeu.focus)
        @name = name || Vedeu.focus
      end

      # @return [Array|Vedeu::Error::ModelNotFound]
      def by_name
        Vedeu.clear_content_by_name(name)

        buffer.render

        Vedeu.trigger(:_refresh_border_, name)
      end

      protected

      # @!attribute [r] name
      # @macro return_name
      attr_reader :name

      private

      # @macro buffer_by_name
      def buffer
        Vedeu.buffers.by_name(name)
      end

    end # Refresh

  end # Buffers

end # Vedeu

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vedeu-0.8.32 lib/vedeu/buffers/refresh.rb
vedeu-0.8.31 lib/vedeu/buffers/refresh.rb
vedeu-0.8.30 lib/vedeu/buffers/refresh.rb
vedeu-0.8.29 lib/vedeu/buffers/refresh.rb
vedeu-0.8.28 lib/vedeu/buffers/refresh.rb
vedeu-0.8.27 lib/vedeu/buffers/refresh.rb
vedeu-0.8.26 lib/vedeu/buffers/refresh.rb