class Pwl::Commands::Export

Constants

DEFAULT_EXPORT_TEMPLATE

Public Instance Methods

call(args, options) click to toggle source
# File lib/pwl/commands/export.rb, line 6
def call(args, options)
  options.default :format => 'html'

  # TODO See Stats for slightly changed approach using a method
  presenter = {:html => Presenter::Html, :json => Presenter::Json, :yaml => Presenter::Yaml}[options.format.to_sym]
  exit_with(:unknown_export_format, options.verbose, :format => options.format) if presenter.nil?

  begin
    locker = open_locker(options)
    puts presenter.new(locker).to_s
  rescue Dialog::Cancelled
    exit_with(:aborted, options.verbose)
  end
end