open hoagieopen hoagie
Sign up Sign in
main
Raw Blame History
🥒 dill_pickles.rb 23 lines 0.7 KB
1# dill_pickles.rb -- deployment of crunch. Brined. Cold.
2#
3# The hoagie SHIPS WITHOUT PICKLES BY DEFAULT. It's a build flag.
4# Enable with: --with-pickles=whole,slice,extra
5class DillPickles
6 EXPECTED = {
7 brine: %w[water vinegar dill garlic salt],
8 texture: :crunch,
9 temperature: :cold, # a warm pickle is a privacy violation
10 }.freeze
11 
12 def self.deploy(hoagie, opts = {})
13 raise 'hoagie_cold! refrigerate the jar first' unless cold?
14 
15 count = opts.fetch(:count, 5) # 5 is the integer, not the opinion
16 count.times { hoagie.layers << Pickle.new(spear: true) }
17 hoagie.flag(:crunch, true) # only set once the pickles ARRIVED
18 end
19 
20 def self.cold?
21 EXPECTED[:temperature] == :cold
22 end
23end