class Tailwindcss::Purger::Conveyor
Attributes
output[R]
staged_output[R]
Public Class Methods
new(input, output = +"")
click to toggle source
# File lib/tailwindcss/purger.rb, line 84 def initialize(input, output = +"") @input = input @output = output @staged_output = [] end
Public Instance Methods
conditionally_keep(pattern) { |match) ? match : (break "")| ... }
click to toggle source
# File lib/tailwindcss/purger.rb, line 114 def conditionally_keep(pattern) keep(pattern) do |match| (yield match) ? match.to_s : (break "") end end
consume(pattern)
click to toggle source
# File lib/tailwindcss/purger.rb, line 90 def consume(pattern) match = pattern.match(@input) @input = match.post_match if match match end
Also aliased as: discard
done?()
click to toggle source
# File lib/tailwindcss/purger.rb, line 120 def done? @input.empty? end
keep(pattern) { |match) : match| ... }
click to toggle source
# File lib/tailwindcss/purger.rb, line 105 def keep(pattern) if match = consume(pattern) string = block_given? ? (yield match) : match.to_s @output << @staged_output.shift until @staged_output.empty? @output << string string end end
stage_output(pattern) { |match) : match| ... }
click to toggle source
# File lib/tailwindcss/purger.rb, line 97 def stage_output(pattern) if match = consume(pattern) string = block_given? ? (yield match) : match.to_s @staged_output << string string end end