class SleepingKingStudios::Tasks::Task

Encapsulates a Thor task as a class object.

Attributes

options[R]

@return [Hash] The command-line options passed in via Thor.

Public Class Methods

new(options) click to toggle source

@param options [Hash] The command-line options passed in via Thor.

# File lib/sleeping_king_studios/tasks/task.rb, line 59
def initialize options
  @options = options
end

Public Instance Methods

call(*_args;) click to toggle source

Performs the task with the given arguments. Overriden by subclasses.

# File lib/sleeping_king_studios/tasks/task.rb, line 67
def call *_args; end
mute!() click to toggle source

Mutes the task.

# File lib/sleeping_king_studios/tasks/task.rb, line 70
def mute!
  @mute = true
end
mute?() click to toggle source

@return [Boolean] True if the task has been muted, otherwise false.

# File lib/sleeping_king_studios/tasks/task.rb, line 75
def mute?
  !!@mute
end
Also aliased as: muted?
muted?()
Alias for: mute?
say(*args) click to toggle source

Prints the given message unless the task has been muted.

@see Thor::Shell#say.

Calls superclass method
# File lib/sleeping_king_studios/tasks/task.rb, line 83
def say *args
  return if mute?

  super
end

Private Instance Methods

tools() click to toggle source
# File lib/sleeping_king_studios/tasks/task.rb, line 91
def tools
  SleepingKingStudios::Tools::Toolbelt.instance
end