Sha256: 738fae6467e0d86673c3835f6f1df3cd776deef788284c8c44050e7b827acaf1

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

module Vedeu

  # Refreshes the terminal.
  #
  module Refresh

    module_function

    # Refresh all registered interfaces.
    #
    # @return [Array]
    def all
      Vedeu.interfaces.registered.each { |name| by_name(name) }
    end

    # Refresh the interface which is currently focussed.
    #
    # @return [Array|ModelNotFound|NilClass]
    def by_focus
      by_name(Vedeu.focus) if Vedeu.focus
    end

    # Refresh an interface, or collection of interfaces belonging to a group.
    #
    # @param group_name [String] The name of the group to be refreshed.
    # @return [Array|ModelNotFound] A collection of the names of interfaces
    #   refreshed, or an exception if the group was not found.
    def by_group(group_name)
      Vedeu.log(type: :info, message: "Refreshing group: '#{group_name}'")

      Vedeu.groups.find!(group_name).members.each { |name| by_name(name) }
    end

    # Refresh an interface by name.
    #
    # @param name [String] The name of the interface to be refreshed using the
    #   named buffer.
    # @return [Array|ModelNotFound]
    def by_name(name)
      Vedeu.log(type: :info, message: "Refreshing interface: '#{name}'")

      Vedeu.buffers.by_name(name).render
    end

  end # Refresh

end # Vedeu

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.4.22 lib/vedeu/output/refresh.rb
vedeu-0.4.21 lib/vedeu/output/refresh.rb
vedeu-0.4.20 lib/vedeu/output/refresh.rb
vedeu-0.4.19 lib/vedeu/output/refresh.rb