Module: Hecks::Bluebook::Behaviour::Policy
- Included in:
- Policy
- Defined in:
- lib/hecks/bluebook/behaviour/policy.rb
Overview
WHAT A POLICY DOES. Its declared half is four plain fields; these are the readings taken off them.
Instance Method Summary collapse
- #event_name ⇒ Object
- #event_qualifier ⇒ Object
-
#fans_out? ⇒ Boolean
WHETHER THIS POLICY FANS OUT —
for_eachnames a query, and a non-empty one turns a single reaction into one dispatch per row the query answers. -
#for_each_route(default_domain) ⇒ Object
THE FAN-OUT QUERY'S ROUTE, split the way the runtime runs it:
[query_domain, aggregate_name, query_name]. -
#guarded? ⇒ Boolean
WHETHER THIS POLICY IS GUARDED — a non-empty
wheredecides whether the policy fires at all, read against the triggering event's own payload. -
#hecks_name ⇒ Object
The BLUEBOOK's name for this construct, asked the same way of a class that has crossed over and of an IR object that has not.
Instance Method Details
#event_name ⇒ Object
14 |
# File 'lib/hecks/bluebook/behaviour/policy.rb', line 14 def event_name = Naming.unqualified(@on_event) |
#event_qualifier ⇒ Object
12 |
# File 'lib/hecks/bluebook/behaviour/policy.rb', line 12 def event_qualifier = Naming.qualifier(@on_event) |
#fans_out? ⇒ Boolean
WHETHER THIS POLICY FANS OUT — for_each names a query, and a
non-empty one turns a single reaction into one dispatch per row
the query answers. Read by the interpreter that runs the fan-out
and by the property that checks it dispatched once per row.
20 |
# File 'lib/hecks/bluebook/behaviour/policy.rb', line 20 def fans_out? = !@for_each.to_s.empty? |
#for_each_route(default_domain) ⇒ Object
THE FAN-OUT QUERY'S ROUTE, split the way the runtime runs it:
[query_domain, aggregate_name, query_name]. The query runs
against the triggering event's OWN domain unless for_each
names one ("Domain::Aggregate.query"). Deliberately independent
of across/target_domain, which name where trigger fires,
not where the fan-out's own query runs.
33 34 35 36 37 |
# File 'lib/hecks/bluebook/behaviour/policy.rb', line 33 def for_each_route(default_domain) path, query_name = @for_each.to_s.split(".", 2) domain, aggregate = path.to_s.include?("::") ? path.split("::", 2) : [default_domain.to_s, path] [domain, aggregate, query_name] end |
#guarded? ⇒ Boolean
WHETHER THIS POLICY IS GUARDED — a non-empty where decides
whether the policy fires at all, read against the triggering
event's own payload.
25 |
# File 'lib/hecks/bluebook/behaviour/policy.rb', line 25 def guarded? = !@where.to_s.empty? |
#hecks_name ⇒ Object
The BLUEBOOK's name for this construct, asked the same way of a class that has crossed over and of an IR object that has not. Collapses into Construct when this one crosses.
10 |
# File 'lib/hecks/bluebook/behaviour/policy.rb', line 10 def hecks_name = @name |