class ChoresKit::Task
Attributes
name[R]
Public Class Methods
new(name, *args)
click to toggle source
# File lib/chores_kit/chore/task.rb, line 7 def initialize(name, *args) @name = name @args = args end
Public Instance Methods
method_missing(name, *args)
click to toggle source
rubocop:disable Style/MethodMissing
# File lib/chores_kit/chore/task.rb, line 25 def method_missing(name, *args) attributes = { callable: args, callee: self } if name == :sh @callable = Executors::Shell.new(name, attributes) end end
run()
click to toggle source
# File lib/chores_kit/chore/task.rb, line 12 def run raise "Task doesn't have any executors" if @callable.nil? puts "Running #{@callable.friendly_name} executor with command #{@callable.command} at #{Time.now}" duration = Benchmark.realtime do @callable.run! end puts "Took #{Integer(duration * 1000)}ms to run\n\n" end