# frozen_string_literal: true require 'json' require 'yajl' # Sharable methods module Utils include Logging def true?(obj) obj.to_s.casecmp('true').zero? end def json_parse(string) JSON.parse(string) rescue JSON::ParserError => e log.fatal "json parse err: '''#{e.message}'''\n\t#{e.backtrace.join("\n\t")}" exit 1 end def fail_and_exit(text) log.fatal text exit 1 end end