Sha256: ec195b4017b47c88a7803ae88ab597df5fbab20b6041da35c7e9546e67dc8024

Contents?: true

Size: 399 Bytes

Versions: 1

Compression:

Stored size: 399 Bytes

Contents

module Sprinkle
  class Sequence
    attr_accessor :stages

    def initialize(&block)
      self.instance_eval &block if block
    end

    def method_missing(sym, *args, &block)
      @stages ||= ActiveSupport::OrderedHash.new
      @stages[sym] = block
    end

    def each(&block)
      @stages.each do |section, commands|
        block.call section, commands.call
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sprinkle-0.1.4 lib/sprinkle/sequence.rb