Class: Pandocomatic::SkipCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/pandocomatic/command/skip_command.rb

Overview

A command to skip a file or directory

Instance Attribute Summary collapse

Attributes inherited from Command

#errors, #index

Instance Method Summary collapse

Methods inherited from Command

#all_errors, #count, #directory?, #dry_run?, #errors?, #execute, #file_modified?, #index_to_s, #make_quiet, #modified_only?, #multiple?, #quiet?, reset, #runnable?, #src_root, #uncount

Constructor Details

#initialize(src, message) ⇒ SkipCommand

Create a new SkipCommand

Parameters:

  • src (String)

    path to the file to skip

  • message (String)

    the message explaining why this file is being skipped



39
40
41
42
43
# File 'lib/pandocomatic/command/skip_command.rb', line 39

def initialize(src, message)
  super()
  @src = src
  @message = message
end

Instance Attribute Details

#messageString

Returns message explaining why the file or directory is being skipped.

Returns:

  • (String)

    message explaining why the file or directory is being skipped.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/pandocomatic/command/skip_command.rb', line 31

class SkipCommand < Command
  attr_reader :src, :message

  # Create a new SkipCommand
  #
  # @param src [String] path to the file to skip
  # @param message [String] the message explaining why this file is being
  #   skipped
  def initialize(src, message)
    super()
    @src = src
    @message = message
  end

  # Has this SkipCommand a message?
  #
  # @return [Boolean]
  def message?
    !((@message.nil? or @message.empty?))
  end

  # 'Run' this SkipCommand by doing nothing
  def run; end

  # Skip this command
  #
  # @return [Boolean] true
  def skip?
    true
  end

  # A string representation of this SkipCommand
  #
  # @return [String]
  def to_s
    "skipping #{File.basename @src}" + (": #{@message}" if message?)
  end
end

#srcString

Returns the file or directory to skip.

Returns:

  • (String)

    the file or directory to skip



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/pandocomatic/command/skip_command.rb', line 31

class SkipCommand < Command
  attr_reader :src, :message

  # Create a new SkipCommand
  #
  # @param src [String] path to the file to skip
  # @param message [String] the message explaining why this file is being
  #   skipped
  def initialize(src, message)
    super()
    @src = src
    @message = message
  end

  # Has this SkipCommand a message?
  #
  # @return [Boolean]
  def message?
    !((@message.nil? or @message.empty?))
  end

  # 'Run' this SkipCommand by doing nothing
  def run; end

  # Skip this command
  #
  # @return [Boolean] true
  def skip?
    true
  end

  # A string representation of this SkipCommand
  #
  # @return [String]
  def to_s
    "skipping #{File.basename @src}" + (": #{@message}" if message?)
  end
end

Instance Method Details

#message?Boolean

Has this SkipCommand a message?

Returns:

  • (Boolean)


48
49
50
# File 'lib/pandocomatic/command/skip_command.rb', line 48

def message?
  !((@message.nil? or @message.empty?))
end

#runObject

‘Run’ this SkipCommand by doing nothing



53
# File 'lib/pandocomatic/command/skip_command.rb', line 53

def run; end

#skip?Boolean

Skip this command

Returns:

  • (Boolean)

    true



58
59
60
# File 'lib/pandocomatic/command/skip_command.rb', line 58

def skip?
  true
end

#to_sString

A string representation of this SkipCommand

Returns:

  • (String)


65
66
67
# File 'lib/pandocomatic/command/skip_command.rb', line 65

def to_s
  "skipping #{File.basename @src}" + (": #{@message}" if message?)
end