Class: Duty::Tasks::Base::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/duty/tasks.rb

Direct Known Subclasses

Ruby, Shell

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description, callable) ⇒ Command

Returns a new instance of Command.



107
108
109
110
111
112
113
# File 'lib/duty/tasks.rb', line 107

def initialize(description, callable)
  @description = description 
  @callable = callable
  @success = false
  @error = nil
  @logger = []
end

Class Method Details

.run(description, callable) ⇒ Object



115
116
117
# File 'lib/duty/tasks.rb', line 115

def self.run(description, callable)
  new(description, callable).tap {|command| command.execute}
end

Instance Method Details

#descriptionObject



123
124
125
# File 'lib/duty/tasks.rb', line 123

def description
  @description
end

#errorObject



131
132
133
# File 'lib/duty/tasks.rb', line 131

def error
  @error
end

#loggerObject



127
128
129
# File 'lib/duty/tasks.rb', line 127

def logger
  @logger
end

#success?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/duty/tasks.rb', line 119

def success?
  @success
end