Sha256: 682ca726fe8f028a94254ccbb93a85b244e5ac1b9aa0715d466bb27b3107b7a6

Contents?: true

Size: 508 Bytes

Versions: 1

Compression:

Stored size: 508 Bytes

Contents

class Chores
  attr_reader :chore

  def self.define(name, &block)
    proxy = ChoresKit::DefinitionProxy.new(name)
    proxy.instance_eval(&block) if block_given?
    proxy.chore
  end

  def initialize(filename)
    @chore = instance_eval(File.read(filename))
  end

  def self.load(filename)
    new(filename).chore
  end

  def self.load_all
    tasks = Pathname.glob('tasks/**/*.rb')

    tasks.each do |task_file|
      load(Pathname.pwd + task_file)
    end
  end

  def run
    @chore.run!
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chores_kit-0.2.5 lib/chores_kit/chores.rb