Module: Hubbado::Sequence::Sequencer::ClassMethods
- Defined in:
- lib/hubbado/sequence/sequencer.rb
Instance Method Summary collapse
-
#build ⇒ Object
Default factory: a sequencer with no configurable dependencies needs nothing more than ‘new`.
-
#call(ctx = nil, **kwargs) ⇒ Object
Bridge between the kwargs boundary (controllers and other top-level callers) and the ctx-passing convention used inside the framework.
- #i18n_scope ⇒ Object
Instance Method Details
#build ⇒ Object
Default factory: a sequencer with no configurable dependencies needs nothing more than ‘new`. Sequencers that have dependencies override `self.build` to run the corresponding `Macro.configure(instance, …)` calls.
72 73 74 |
# File 'lib/hubbado/sequence/sequencer.rb', line 72 def build new end |
#call(ctx = nil, **kwargs) ⇒ Object
Bridge between the kwargs boundary (controllers and other top-level callers) and the ctx-passing convention used inside the framework. A caller can supply either an existing Ctx (the nested-sequencer case) or keyword arguments that become the initial ctx (the outermost case).
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/hubbado/sequence/sequencer.rb', line 56 def call(ctx = nil, **kwargs) if ctx.nil? ctx = Ctx.build(kwargs) elsif !kwargs.empty? raise ArgumentError, "#{name}.() takes either a Ctx or keyword arguments, not both" elsif !ctx.is_a?(Ctx) ctx = Ctx.build(ctx) end build.call(ctx) end |
#i18n_scope ⇒ Object
76 77 78 |
# File 'lib/hubbado/sequence/sequencer.rb', line 76 def i18n_scope @i18n_scope ||= ::Casing::Underscore::String.(name).gsub('/', '.') end |