Sha256: 8752d04be793fa0e532c94f7956b8f51480096238b45f33bba1f79c8137176d0

Contents?: true

Size: 913 Bytes

Versions: 1

Compression:

Stored size: 913 Bytes

Contents

# frozen_string_literal: true

module Qonfig
  # @api private
  # @since 0.1.0
  class CommandSet
    # @return [Array<Qonfig::Commands::Base>]
    #
    # @api private
    # @since 0.1.0
    attr_reader :commands

    # @api private
    # @since 0.1.0
    def initialize
      @commands = []
    end

    # @param command [Qonfig::Commands::Base]
    # @return [void]
    #
    # @api private
    # @since 0.1.0
    def add_command(command)
      commands << command
    end
    alias_method :<<, :add_command

    # @param block [Proc]
    # @return [Enumerable]
    #
    # @api private
    # @since 0.1.0
    def each(&block)
      block_given? ? commands.each(&block) : commands.each
    end

    # @param command_set [Qonfig::CommandSet]
    # @return [Qonfig::CommandSet]
    #
    # @api private
    # @since 0.1.0
    def concat(command_set)
      commands.concat(command_set.commands)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qonfig-0.1.0 lib/qonfig/command_set.rb