Module: Rooibos::Router

Defined in:
lib/rooibos/router.rb,
lib/rooibos/router/rule.rb,
lib/rooibos/router/guard.rb,
lib/rooibos/router/route.rb,
lib/rooibos/router/action.rb,
lib/rooibos/router/registry.rb,
lib/rooibos/router/predicate.rb,
lib/rooibos/router/flow/inward.rb,
lib/rooibos/router/flow/outward.rb,
lib/rooibos/router/rule/forward.rb,
lib/rooibos/router/rule/observe.rb,
lib/rooibos/router/rule/receive.rb,
lib/rooibos/router/flow/dispatch.rb,
lib/rooibos/router/router_update.rb,
lib/rooibos/router/rule/otherwise.rb,
lib/rooibos/router/registry/routes.rb,
lib/rooibos/router/registry/actions.rb,
lib/rooibos/router/registry/forwards.rb,
lib/rooibos/router/registry/observes.rb,
lib/rooibos/router/registry/receives.rb,
lib/rooibos/router/registry/otherwises.rb

Overview

Fractal routing DSL for composing hierarchical updates.

A growing app accumulates message-handling logic. One Update handles dozens of cases. Model fields multiply. View code sprawls.

Include Router in a fragment module. It decomposes your Update into declarative rules: routes bind nested fragments to model slices, forwards route messages inward, receives handle them exclusively, and observers process without stopping the flow.

Use it to build tab containers, panel layouts, or any hierarchy where messages flow inward through nested fragments.

Example

module Dashboard
  include Rooibos::Router

  route :sidebar, to: Sidebar
  route :main,    to: MainPanel

  receive_events :ctrl_c, :quit
  action :quit, -> { Rooibos::Command.exit }

  forward_events :enter, to: :main, as: :submit
  otherwise route_to: :main

  Update = from_router
end

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



64
65
66
# File 'lib/rooibos/router.rb', line 64

def self.included(base) # :nodoc:
  base.extend(ClassMethods)
end