Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

don't depend on Yajl

  • Loading branch information...
commit febfaac7ba910b0c25a3527249c012c3a80481ad 1 parent d1d9664
@mislav authored
Showing with 10 additions and 2 deletions.
  1. +5 −1 bin/gorgeous
  2. +5 −1 lib/gorgeous.rb
View
6 bin/gorgeous
@@ -81,7 +81,11 @@ if output_format == :ruby
require 'pp'
output = input.data.pretty_inspect
elsif output_format == :json
- require 'yajl/json_gem'
+ begin
+ require 'yajl/json_gem'
+ rescue LoadError
+ require 'json'
+ end
output = JSON.pretty_generate input.data
elsif output_format == :yaml
require 'yaml'
View
6 lib/gorgeous.rb
@@ -125,7 +125,11 @@ def data
require 'active_support/core_ext/hash/conversions'
Hash.from_xml(to_s)
when :json
- require 'yajl/json_gem'
+ begin
+ require 'yajl/json_gem'
+ rescue LoadError
+ require 'json'
+ end
JSON.parse to_s
when :yaml
require 'yaml'
Please sign in to comment.
Something went wrong with that request. Please try again.