#!/usr/bin/env ruby require "bundler/setup" require "dhclient" # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. def pretty_print(content, format=:json) if format == :xml require 'rexml/document' formatter = REXML::Formatters::Pretty.new formatter.compact = true xml = REXML::Document.new content formatter.write(xml, out) elsif format == :json out = JSON.parse(content) else out = "Unsupported format #{format}" end return out end # (If you use this, don't forget to add pry to your Gemfile!) require "pry" Pry.start # require "irb" # IRB.start(__FILE__)