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.



102
103
104
105
106
107
108
# File 'lib/duty/tasks.rb', line 102

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

Class Method Details

.run(description, callable) ⇒ Object



110
111
112
# File 'lib/duty/tasks.rb', line 110

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

Instance Method Details

#descriptionObject



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

def description
  @description
end

#errorObject



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

def error
  @error
end

#loggerObject



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

def logger
  @logger
end

#success?Boolean

Returns:

  • (Boolean)


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

def success?
  @success
end