Module: Ariadna::Tools::Output

Defined in:
lib/ariadna/tools/output.rb

Class Method Summary collapse

Class Method Details

.error(message) ⇒ Object



15
16
17
18
# File 'lib/ariadna/tools/output.rb', line 15

def self.error(message)
  $stderr.write("Error: #{message}\n")
  exit 1
end

.json(result, raw: false, raw_value: nil) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/ariadna/tools/output.rb', line 6

def self.json(result, raw: false, raw_value: nil)
  if raw && !raw_value.nil?
    $stdout.write(raw_value.to_s)
  else
    $stdout.write(JSON.pretty_generate(result))
  end
  exit 0
end