Sha256: 28429b7ce2f9cf212f190b5f8811d77f16632f21eb1af4167020165ba6a0a74a

Contents?: true

Size: 1.24 KB

Versions: 7

Compression:

Stored size: 1.24 KB

Contents

module Vedeu

  module Groups

    # Clear the interfaces belonging to the named group.
    #
    class Clear

      class << self

        # Clears the group of interfaces belonging to the given name.
        #
        # @example
        #   Vedeu.trigger(:_clear_group_, name)
        #   Vedeu.clear_by_group(name)
        #
        # @param name [String|Symbol]
        # @return [void]
        def render(name)
          new(name).render
        end
        alias_method :clear_by_group, :render
        alias_method :by_group, :render

      end # Eigenclass

      # Return a new instance of Vedeu::Groups::Clear.
      #
      # @param name [String|Symbol]
      # @return [Vedeu::Groups::Clear]
      def initialize(name)
        @name = name
      end

      # @return [void]
      def render
        members.each { |name| Vedeu.trigger(:_clear_view_, name) }
      end

      protected

      # @!attribute [r] name
      # @return [String|Symbol]
      attr_reader :name

      private

      # @return [Array<String>]
      def members
        Vedeu.groups.by_name(name).members
      end

    end # Clear

  end # Groups

  # @!method clear_by_group
  #   @see Vedeu::Groups::Clear.render
  def_delegators Vedeu::Groups::Clear, :clear_by_group

end # Vedeu

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vedeu-0.6.29 lib/vedeu/groups/clear.rb
vedeu-0.6.28 lib/vedeu/groups/clear.rb
vedeu-0.6.27 lib/vedeu/groups/clear.rb
vedeu-0.6.26 lib/vedeu/groups/clear.rb
vedeu-0.6.25 lib/vedeu/groups/clear.rb
vedeu-0.6.24 lib/vedeu/groups/clear.rb
vedeu-0.6.23 lib/vedeu/groups/clear.rb