Sha256: 4c5b35a8857036f7b443c8f21df8a3bacac61cceb822db8cf1c91b30bd2a3c94

Contents?: true

Size: 442 Bytes

Versions: 13

Compression:

Stored size: 442 Bytes

Contents

class Mercury
  class Cps

    # Syntactic sugar for and_then chains.
    def self.seq(&block)
      s = Seq.new
      block.call(s.method(:chain))
      s.m
    end

    class Seq
      def m
        @m ||= Cps.identity # we need an initial Cps to chain onto
      end

      def chain(proc=nil, &block)
        @m = m.and_then(&(proc || block))
      end
    end
  end
end

class Method
  alias_method :en, :call # to be called `th.en`
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mercury_amqp-0.10.0 lib/mercury/cps/seq.rb
mercury_amqp-0.9.0 lib/mercury/cps/seq.rb
mercury_amqp-0.8.0 lib/mercury/cps/seq.rb
mercury_amqp-0.7.0 lib/mercury/cps/seq.rb
mercury_amqp-0.6.1 lib/mercury/cps/seq.rb
mercury_amqp-0.6.0 lib/mercury/cps/seq.rb
mercury_amqp-0.5.0 lib/mercury/cps/seq.rb
mercury_amqp-0.4.0 lib/mercury/cps/seq.rb
mercury_amqp-0.3.0 lib/mercury/cps/seq.rb
mercury_amqp-0.2.0 lib/mercury/cps/seq.rb
mercury_amqp-0.1.9 lib/mercury/cps/seq.rb
mercury_amqp-0.1.7 lib/mercury/cps/seq.rb
mercury_amqp-0.1.6 lib/mercury/cps/seq.rb