Sha256: 9789bc7bead63ecb5da04cb0c14e3c4c56a7912711d863a520635f97a8d21257

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

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

    attr_reader :started_callback
    attr_reader :finished_callback
    attr_reader :task_callback

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

      @task_callback = block
    end

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

      @started_callback = block
    end

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

      @finished_callback = block
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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