Sha256: 87637d316bd1fc7983a93559850acc0d3e4b8d1b9ebefddf46a03ef94f0c803b

Contents?: true

Size: 387 Bytes

Versions: 13

Compression:

Stored size: 387 Bytes

Contents

module Muack
  class Block
    attr_accessor :block, :context
    def initialize block, context=nil
      self.block, self.context = block, context
    end

    def call *args, &actual_block
      if context # ruby: no way to pass actual_block to instance_exec
        context.instance_exec(*args, &block)
      else
        block.call(*args, &actual_block)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
muack-1.4.0 lib/muack/block.rb
muack-1.3.2 lib/muack/block.rb
muack-1.3.1 lib/muack/block.rb
muack-1.3.0 lib/muack/block.rb
muack-1.2.0 lib/muack/block.rb
muack-1.1.2 lib/muack/block.rb
muack-1.1.1 lib/muack/block.rb
muack-1.1.0 lib/muack/block.rb
muack-1.0.4 lib/muack/block.rb
muack-1.0.3 lib/muack/block.rb
muack-1.0.2 lib/muack/block.rb
muack-1.0.1 lib/muack/block.rb
muack-1.0.0 lib/muack/block.rb