Method: YARD::CLI::Stats#output

Defined in:
lib/yard/cli/stats.rb

#output(name, data, undoc = nil) ⇒ void

This method returns an undefined value.

Prints a statistic to standard out. This method is optimized for getting Integer values, though it allows any data to be printed.

Parameters:

  • name (String)

    the statistic name

  • data (Integer, String)

    the numeric (or any) data representing the statistic. If data is an Integer, it should represent the total objects of a type.

  • undoc (Integer, nil) (defaults to: nil)

    number of undocumented objects for the type

Since:

  • 0.6.0

[View source]

140
141
142
143
144
145
146
147
148
149
# File 'lib/yard/cli/stats.rb', line 140

def output(name, data, undoc = nil)
  @total += data if data.is_a?(Integer) && undoc
  @undocumented += undoc if undoc.is_a?(Integer)
  if undoc
    data = ("%5s (% 5d undocumented)" % [data, undoc])
  else
    data = "%5s" % data
  end
  puts("%-12s %s" % [name + ":", data])
end