class Vizkit::CallbackSpec::MethodNameAdapter

Callback adapter for callbacks specified by a method name

Attributes

sym[R]

Public Class Methods

new(sym) click to toggle source
# File lib/vizkit/plugin.rb, line 210
def initialize(sym)
    raise ArgumentError, "Cannot initialize MethodNameAdapter: No method is given" unless sym
    @sym = sym
end

Public Instance Methods

bind(object) click to toggle source
# File lib/vizkit/plugin.rb, line 226
def bind(object)
    object.method(@sym)
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 222
def block_name 
    to_sym
end
call(*args, &block) click to toggle source
# File lib/vizkit/plugin.rb, line 230
def call(*args, &block)
    obj = args.shift
    obj.send(@sym, *args, &block)
end
to_sym() click to toggle source
# File lib/vizkit/plugin.rb, line 215
def to_sym
    sym.to_sym
end