Class: SleepingKingStudios::Tasks::Task
- Inherits:
-
Object
- Object
- SleepingKingStudios::Tasks::Task
- Extended by:
- ClassMethods
- Includes:
- Thor::Shell
- Defined in:
- lib/sleeping_king_studios/tasks/task.rb
Overview
Encapsulates a Thor task as a class object.
Direct Known Subclasses
Apps::Bundle::InstallTask, Apps::Bundle::UpdateTask, Apps::Ci::RSpecTask, Apps::Ci::RuboCopTask, Apps::Ci::SimpleCovTask, Apps::Ci::StepWrapper, Apps::Ci::StepsTask, Ci::CucumberTask, Ci::EslintTask, Ci::JestTask, Ci::RSpecEachTask, Ci::RSpecTask, Ci::RuboCopTask, Ci::SimpleCovTask, Ci::StepsRunner, File::NewTask
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#options ⇒ Hash
readonly
The command-line options passed in via Thor.
Instance Method Summary collapse
-
#call(*_args) ⇒ Object
Performs the task with the given arguments.
-
#initialize(options) ⇒ Task
constructor
A new instance of Task.
-
#mute! ⇒ Object
Mutes the task.
-
#mute? ⇒ Boolean
(also: #muted?)
True if the task has been muted, otherwise false.
-
#say(*args) ⇒ Object
Prints the given message unless the task has been muted.
Methods included from ClassMethods
description, option, task_name
Constructor Details
#initialize(options) ⇒ Task
Returns a new instance of Task.
59 60 61 |
# File 'lib/sleeping_king_studios/tasks/task.rb', line 59 def initialize @options = end |
Instance Attribute Details
#options ⇒ Hash (readonly)
Returns The command-line options passed in via Thor.
64 65 66 |
# File 'lib/sleeping_king_studios/tasks/task.rb', line 64 def @options end |
Instance Method Details
#call(*_args) ⇒ Object
Performs the task with the given arguments. Overriden by subclasses.
67 |
# File 'lib/sleeping_king_studios/tasks/task.rb', line 67 def call *_args; end |
#mute! ⇒ Object
Mutes the task.
70 71 72 |
# File 'lib/sleeping_king_studios/tasks/task.rb', line 70 def mute! @mute = true end |
#mute? ⇒ Boolean Also known as: muted?
Returns True if the task has been muted, otherwise false.
75 76 77 |
# File 'lib/sleeping_king_studios/tasks/task.rb', line 75 def mute? !!@mute end |
#say(*args) ⇒ Object
Prints the given message unless the task has been muted.
83 84 85 86 87 |
# File 'lib/sleeping_king_studios/tasks/task.rb', line 83 def say *args return if mute? super end |