Class: Weekdone::Cli::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/weekdone/cli/output.rb

Class Method Summary collapse

Class Method Details

.format(data, format: :json, loglevel: Logger::DEBUG) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/weekdone/cli/output.rb', line 6

def format(data, format: :json, loglevel: Logger::DEBUG)
  @@logger = Logger.new(STDERR)
  @@logger.level = loglevel

  if format == :json
    @@logger.debug("print in json format")
    print data.to_json
  elsif format == :text
    @@logger.debug("print in text format")
    formatText(data)
  end
end

.formatText(data) ⇒ Object



19
20
21
# File 'lib/weekdone/cli/output.rb', line 19

def formatText(data)
  print data
end