Sha256: 472c06a2aa3154e3921f6589ec4c978fedcf71131d2bcc6019f0f80f108d62f9

Contents?: true

Size: 695 Bytes

Versions: 4

Compression:

Stored size: 695 Bytes

Contents

module Riot
  class RunnableBlock
    attr_reader :definition
    def initialize(description, &definition)
      @description, @definition = description, definition || proc { false }
    end

    def to_s; @description; end
  end # RunnableBlock

  class Setup < RunnableBlock
    def initialize(&definition)
      super("setup", &definition)
    end

    def run(situation)
      situation.setup(&definition)
      [:setup]
    end
  end # Setup

  class Helper < RunnableBlock
    def initialize(name, &definition)
      super("helper #{name}", &definition)
      @name = name
    end

    def run(situation)
      situation.helper(@name, &definition)
      [:helper]
    end
  end
end # Riot

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
riot-0.12.1 lib/riot/runnable.rb
riot-0.12.0 lib/riot/runnable.rb
riot-0.12.0.pre lib/riot/runnable.rb
riot-0.11.4 lib/riot/runnable.rb