Sha256: ff29eebbb3736aea364989463191fae7c8ecede6622aba745ae7c3d297e1ec54
Contents?: true
Size: 945 Bytes
Versions: 9
Compression:
Stored size: 945 Bytes
Contents
class DripDrop::Node # See the documentation for +nodelet+ in DripDrop::Node class Nodelet attr_accessor :name, :routing def initialize(ctx, name, *configure_args) @ctx = ctx @name = name @internal_routing = {} configure(*configure_args) end def configure(*args) # Do nothing! end def route(name,handler_type,*handler_args) handler = @ctx.route_full(self, name, handler_type, *handler_args) @internal_routing[name] = handler (class << self; self; end).class_eval do define_method(name) { handler } end end # Check for the method as a route in @ctx, if found # memoize it by defining it as a singleton def method_missing(meth,*args) (class << self; self; end).class_eval do define_method(meth) { @ctx.send(meth,*args) } end self.send(meth,*args) end end end
Version data entries
9 entries across 9 versions & 1 rubygems