Method: Jig#fill!
- Defined in:
- lib/jig.rb
#fill! ⇒ Object
Calls the block once for each gap in the jig passing the name of the gap. If the block returns the gapname, the gap remains in the jig, otherwise the gap is replaced with the return value of the block. If called without a block, all the gaps are replaced with the empty string.
834 835 836 837 838 839 840 841 842 843 844 845 |
# File 'lib/jig.rb', line 834 def fill! adjust = 0 gaps.each_with_index do |gap, index| match = index + adjust items = block_given? && yield(gap) if items != gap fill = rawgaps.at(match).fill(items) adjust += plug_gap!(match, fill) - 1 end end self end |