class Vizkit::CallbackSpec::BlockAdapter

Callback adapter for code blocks tied to an object or code blocks which does not need to be tied.

Public Class Methods

new(block, object=nil) click to toggle source
# File lib/vizkit/plugin.rb, line 270
def initialize(block, object=nil)
    @block, @object = block, object
end

Public Instance Methods

bind(object) click to toggle source
# File lib/vizkit/plugin.rb, line 284
def bind(object)
    BlockAdapter.new(@block, object)
end
block_name() click to toggle source

Name of the code block which is used for pretty_print of the PluginSpec @return [Symbol] the name

# File lib/vizkit/plugin.rb, line 291
def block_name 
    :CodeBlock 
end
call(*args, &block) click to toggle source
# File lib/vizkit/plugin.rb, line 273
def call(*args, &block)
    if block
        args << block
    end
    if @object
        @block.call(@object, *args)
    else
        @block.call(*args)
    end
end