class Multiblock::Wrapper

Public Class Methods

new(&default) click to toggle source
# File lib/multiblock/wrapper.rb, line 3
def initialize(&default)
  default ||= ::Kernel.lambda { |*args| nil }

  @blocks = ::Hash.new(default)
end

Public Instance Methods

call(name, *args) click to toggle source
# File lib/multiblock/wrapper.rb, line 14
def call(name, *args)
  @blocks[name.to_s].call(*args)
end
inspect() click to toggle source
# File lib/multiblock/wrapper.rb, line 18
def inspect
  "#<Multiblock::Wrapper @blocks=#{@blocks.inspect}>"
end
method_missing(name, *args, &blk) click to toggle source
# File lib/multiblock/wrapper.rb, line 9
def method_missing(name, *args, &blk)
  ::Kernel.raise ::ArgumentError.new("No block given when registering '#{name}' block.") if blk.nil?
  @blocks[name.to_s] = blk
end