Sha256: 92c8cc50f8e6da6e05be60b8ec12b9eca506d409223889043a23b83280c80cb0

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

module Elevate
  class DSL
    def initialize(&block)
      instance_eval(&block)
    end

    attr_reader :finish_callback
    attr_reader :start_callback
    attr_reader :task_callback
    attr_reader :update_callback

    def on_finish(&block)
      raise "on_finish blocks must accept two parameters" unless block.arity == 2

      @finish_callback = block
    end

    def on_start(&block)
      raise "on_start blocks must accept zero parameters" unless block.arity == 0

      @start_callback = block
    end

    def on_update(&block)
      @update_callback = block
    end

    def task(&block)
      raise "task blocks must accept zero parameters" unless block.arity == 0

      @task_callback = block
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
elevate-0.5.0 lib/elevate/dsl.rb