class Pandocomatic::ConvertListCommand

A Command with sub commands

@!attribute subcommands

@return [Command[]] the subcommands of this ConvertListCommand

Attributes

subcommands[R]

Public Class Methods

new() click to toggle source

Create a new ConvertListCommand

Calls superclass method Pandocomatic::Command::new
# File lib/pandocomatic/command/convert_list_command.rb, line 38
def initialize
  super
  @subcommands = []
end

Public Instance Methods

all_errors() click to toggle source

Get a list of all errors generated while running this command

@return [Error

# File lib/pandocomatic/command/convert_list_command.rb, line 68
def all_errors
  @subcommands.reduce(@errors) do |total, subcommand|
    total + subcommand.all_errors
  end
end
count() click to toggle source

The number of commands to execute when this ConvertListCommand is executed.

# File lib/pandocomatic/command/convert_list_command.rb, line 59
def count
  @subcommands.reduce(0) do |total, subcommand|
    total + subcommand.count
  end
end
execute() click to toggle source

Execute this ConvertListCommand

# File lib/pandocomatic/command/convert_list_command.rb, line 89
def execute
  return if @subcommands.empty?

  description = CommandPrinter.new(self)
  Pandocomatic::LOG.info description
  description.print unless quiet?
  run if !dry_run? && runnable?

  @subcommands.each(&:execute)
end
multiple?() click to toggle source

Can this command have multiple commands?

@return [Boolean] true

# File lib/pandocomatic/command/convert_list_command.rb, line 84
def multiple?
  true
end
push(command) click to toggle source

Push a command to this ConvertListCommand

@param command [Command] command to add

# File lib/pandocomatic/command/convert_list_command.rb, line 46
def push(command)
  @subcommands.push command
end
skip?() click to toggle source

Skip this ConvertListCommand when there are no sub commands

@return [Boolean]

# File lib/pandocomatic/command/convert_list_command.rb, line 53
def skip?
  @subcommands.empty?
end
to_s() click to toggle source

A string representation of this ConvertListCommand

@return [String]

# File lib/pandocomatic/command/convert_list_command.rb, line 77
def to_s
  "converting #{@subcommands.size} items:"
end