class Genesis::Handler
Interface for a GenesisHandler Allows subclasess specifying routes and subscribers in a DSL
Attributes
routes[RW]
subscribers[RW]
Public Class Methods
inherited(subclass)
click to toggle source
Calls superclass method
# File lib/genesis/handler.rb, line 20 def inherited(subclass) subclass.reset! super end
register_route(match, opts = {}, &block)
click to toggle source
# File lib/genesis/handler.rb, line 7 def register_route(match, opts = {}, &block) @routes[match] = { verb: __callee__.to_s, opts: opts, block: block } end
register_subscriber(*_args, &block)
click to toggle source
# File lib/genesis/handler.rb, line 11 def register_subscriber(*_args, &block) @subscribers << { block: block } end
Also aliased as: subscribe
reset!()
click to toggle source
# File lib/genesis/handler.rb, line 15 def reset! @subscribers = [] @routes = {} end