Module: Lab42::NHash::LookupChains
- Included in:
- Lab42::NHash
- Defined in:
- lib/lab42/nhash/lookup_chains.rb
Instance Method Summary collapse
- #push_affix_lookup(prefixes: required, suffixes: required, suffixes_first: false) ⇒ Object
- #push_prefix_lookup(*prefixes) ⇒ Object
- #push_suffix_lookup(*suffixes) ⇒ Object
Instance Method Details
#push_affix_lookup(prefixes: required, suffixes: required, suffixes_first: false) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/lab42/nhash/lookup_chains.rb', line 24 def push_affix_lookup( prefixes: required, suffixes: required, suffixes_first: false ) if suffixes_first suffixes.product( prefixes ).reverse.each do | suff, pref | push_fallback do with_suffix suff do with_prefix pref do again end end end end else prefixes.product( suffixes ).reverse.each do | pref, suff | push_fallback do with_suffix suff do with_prefix pref do again end end end end end end |
#push_prefix_lookup(*prefixes) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/lab42/nhash/lookup_chains.rb', line 4 def push_prefix_lookup *prefixes prefixes.reverse.each do | prefix | push_fallback do with_prefix prefix do again end end end end |
#push_suffix_lookup(*suffixes) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/lab42/nhash/lookup_chains.rb', line 14 def push_suffix_lookup *suffixes suffixes.reverse.each do | suffix | push_fallback do with_suffix suffix do again end end end end |