summaryrefslogtreecommitdiff
path: root/ext/fiddle/lib/fiddle/closure.rb
blob: dc2b7a65becd0711088efaa0feb93850995e7b46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module Fiddle
  class Closure
    attr_reader :ctype
    attr_reader :args

    class BlockCaller < Fiddle::Closure
      def initialize ctype, args, abi = Fiddle::Function::DEFAULT, &block
        super(ctype, args, abi)
        @block = block
      end

      def call *args
        @block.call(*args)
      end
    end
  end
end