Sha256: cc98cb6f886b49eded321b4dc582d744fc58148bc2c6ecddbb1d41ecf84387b9
Contents?: true
Size: 935 Bytes
Versions: 3
Compression:
Stored size: 935 Bytes
Contents
module Quandl module Command class Task module Presentation extend ActiveSupport::Concern def present(object, opts={}) opts = opts.symbolize_keys! opts.reverse_merge!(options.to_h) if options.to_h.present? presenters = Quandl::Command::Presenter.new( object, opts ) # format order of importance format = get_output_format( opts ) # convert each object to_format and write to stdout presenters.each do |presenter| # write requested format to stdout info( presenter.to_format(format) ) # write errors to stderr error( presenter.to_stderr ) unless presenter.valid? end end private def get_output_format(override={}) format = options.output_format || config.output_format || override[:output_format] || 'pipes' format = 'pipes' unless %w{ pipes json qdf }.include?(format.to_s) debug("output_format: #{format}") format end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
quandl-0.3.4 | lib/quandl/command/task/presentation.rb |
quandl-0.3.3 | lib/quandl/command/task/presentation.rb |
quandl-0.3.0 | lib/quandl/command/task/presentation.rb |