Sha256: 0b1c805cc8d65f45e7b2f18fc92397da947f04e8e1cccb80671d61baadcd66ed

Contents?: true

Size: 1.4 KB

Versions: 28

Compression:

Stored size: 1.4 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

  # :nocov:

  # See {file:docs/events/visibility.md#\_clear_group_}
  Vedeu.bind(:_clear_group_) { |name| Vedeu.clear_by_group(name) }

  # :nocov:

end # Vedeu

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
vedeu-0.6.69 lib/vedeu/groups/clear.rb
vedeu-0.6.68 lib/vedeu/groups/clear.rb
vedeu-0.6.67 lib/vedeu/groups/clear.rb
vedeu-0.6.66 lib/vedeu/groups/clear.rb
vedeu-0.6.65 lib/vedeu/groups/clear.rb
vedeu-0.6.64 lib/vedeu/groups/clear.rb
vedeu-0.6.63 lib/vedeu/groups/clear.rb
vedeu-0.6.62 lib/vedeu/groups/clear.rb
vedeu-0.6.61 lib/vedeu/groups/clear.rb
vedeu-0.6.60 lib/vedeu/groups/clear.rb
vedeu-0.6.59 lib/vedeu/groups/clear.rb
vedeu-0.6.58 lib/vedeu/groups/clear.rb
vedeu-0.6.57 lib/vedeu/groups/clear.rb
vedeu-0.6.56 lib/vedeu/groups/clear.rb
vedeu-0.6.54 lib/vedeu/groups/clear.rb
vedeu-0.6.53 lib/vedeu/groups/clear.rb
vedeu-0.6.52 lib/vedeu/groups/clear.rb
vedeu-0.6.51 lib/vedeu/groups/clear.rb
vedeu-0.6.50 lib/vedeu/groups/clear.rb
vedeu-0.6.49 lib/vedeu/groups/clear.rb