Sha256: 7794414c588342a7ab9ea48bc4cc2c19cd5b504b9ddbd171ac22c3ceec316b78

Contents?: true

Size: 275 Bytes

Versions: 2

Compression:

Stored size: 275 Bytes

Contents

module MethodMatching
  class ExtendableBlock
    attr_accessor :block
    
    def initialize(&definition)
      @definition = definition
    end
    
    def call(*args)
      instance_exec(*args, &@definition)
    end

    def block_given?
      !!@block
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pat-maddox-method_matching-0.1.1 lib/method_matching/extendable_block.rb
pat-maddox-method_matching-0.1.2 lib/method_matching/extendable_block.rb