Sha256: 17c2cbfa90210c755791378f017ffa3fba0d54ba5a88ac2d6b54a4eee4684fd1

Contents?: true

Size: 279 Bytes

Versions: 4

Compression:

Stored size: 279 Bytes

Contents

# frozen_string_literal: true

module Phlex
	class Block
		def initialize(context, &block)
			@context = context
			@block = block
		end

		def to_proc
			method(:call).to_proc
		end

		def call(*args, **kwargs)
			@context.instance_exec(*args, **kwargs, &@block)
		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phlex-0.4.0 lib/phlex/block.rb
phlex-0.3.2 lib/phlex/block.rb
phlex-0.3.1 lib/phlex/block.rb
phlex-0.3.0 lib/phlex/block.rb