Sha256: 0b3bdaadeb8499291e6cb22f3604f16694dd83f7b141a64fa533742c15ea9586
Contents?: true
Size: 766 Bytes
Versions: 10
Compression:
Stored size: 766 Bytes
Contents
# coding: utf-8 module TTY class ProgressBar # Used by {Pipeline} to format :current token # # @api private class CurrentFormatter MATCHER = /:current\b/i.freeze def initialize(progress) @progress = progress end # Determines whether this formatter is applied or not. # # @param [Object] value # # @return [Boolean] # # @api private def matches?(value) !!(value.to_s =~ MATCHER) end # Format :current token # # @param [String] value # the value being formatted # # @api public def format(value) value.gsub(MATCHER, @progress.current.to_s) end end # CurrentFormatter end # ProgressBar end # TTY
Version data entries
10 entries across 10 versions & 1 rubygems