Sha256: 0d87a542e7d1907a748f45c4a4a157d5cfd9a0b781df5301243e13b9779c5ec9
Contents?: true
Size: 758 Bytes
Versions: 1
Compression:
Stored size: 758 Bytes
Contents
require 'benchmark' module ChoresKit class Task attr_reader :name def initialize(name, *args) @name = name @args = args end 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 # rubocop:disable Style/MethodMissing def method_missing(name, *args) attributes = { callable: args, callee: self } if name == :sh @callable = Executors::Shell.new(name, attributes) end end # rubocop:enable Style/MethodMissing end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chores_kit-0.2.5 | lib/chores_kit/chore/task.rb |