Module: Hecks::Bluebook::Behaviour::Hecksagon
- Included in:
- Hecksagon
- Defined in:
- lib/hecks/bluebook/behaviour/hexagon.rb
Overview
WHAT A HECKSAGON DOES — the lookups over its declared binds.
Instance Method Summary collapse
-
#bind_for(aggregate_name, verb) ⇒ Object
Aggregate-specific bind wins when one was declared; otherwise falls back to a domain-level default (
b.aggregate.nil?— seeHecksagonBuilder#method_missing). - #binds_for(aggregate_name, verb) ⇒ Object
Instance Method Details
#bind_for(aggregate_name, verb) ⇒ Object
Aggregate-specific bind wins when one was declared; otherwise
falls back to a domain-level default (b.aggregate.nil? — see
HecksagonBuilder#method_missing). Checked directly rather than
via aggregate_name/Naming.demodulise, which would need its own
nil-handling for the default row.
11 12 13 14 |
# File 'lib/hecks/bluebook/behaviour/hexagon.rb', line 11 def bind_for(aggregate_name, verb) @binds.find { |b| b.aggregate_name == aggregate_name.to_s && b.verb.to_s == verb.to_s } || @binds.find { |b| b.aggregate.nil? && b.verb.to_s == verb.to_s } end |
#binds_for(aggregate_name, verb) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/hecks/bluebook/behaviour/hexagon.rb', line 16 def binds_for(aggregate_name, verb) specific = @binds.select { |b| b.aggregate_name == aggregate_name.to_s && b.verb.to_s == verb.to_s } return specific if specific.any? @binds.select { |b| b.aggregate.nil? && b.verb.to_s == verb.to_s } end |