class Columnist::ProgressFormatter

Constants

VALID_OPTIONS

Public Instance Methods

format(options, block) click to toggle source
# File lib/columnist/formatter/progress.rb, line 12
def format(options, block)
    self.validate_options(options, *VALID_OPTIONS)

    self.indicator = options[:indicator] if options[:indicator]
    self.color     = options[:color]
    self.bold      = options[:bold] || false

    block.call

    puts
end
indicator() click to toggle source
# File lib/columnist/formatter/progress.rb, line 33
def indicator
    @indicator ||= '.'
end
progress(override = nil) click to toggle source
# File lib/columnist/formatter/progress.rb, line 24
def progress(override = nil)
    str = override || self.indicator

    str = str.send(self.color) if self.color
    str = str.send('bold') if self.bold

    print str
end