class Pwl::Commands::Stats

Public Instance Methods

call(args, options) click to toggle source
# File lib/pwl/commands/stats.rb, line 34
def call(args, options)
  locker = open_locker(options)

  begin
    puts presenter(options.format).present(locker)
  rescue
    exit_with(:unknown_format, options.verbose, :format => options.format)
  end
end

Private Instance Methods

presenter(format) click to toggle source
# File lib/pwl/commands/stats.rb, line 46
def presenter(format)
  if !format || format.is_a?(TrueClass) || 'text' == format
    StatsPresenter::Text.new
  else
    begin
      {:html => StatsPresenter::Html, :json => StatsPresenter::Json, :yaml => StatsPresenter::Yaml}[format.to_sym].new
    rescue
      raise UnknownFormatError.new(format)
    end
  end
end