Switched JSON parsing to YAJL
authorMichael B. Klein <mbklein@gmail.com>
Fri, 15 Oct 2010 21:03:36 +0000 (14:03 -0700)
committerMichael B. Klein <mbklein@gmail.com>
Fri, 15 Oct 2010 21:03:36 +0000 (14:03 -0700)
lib/edi/edi2json.rb
lib/edi/mapper.rb
lib/openils/mapper.rb
openils-mapper.gemspec

index 0e637e9..37e2985 100644 (file)
@@ -1,9 +1,4 @@
-begin
-  require 'json/pure'
-rescue LoadError
-  warn "WARNING: json-pure not found. Trying json."
-  require 'json'
-end
+require 'yajl'
 
 module EDI
 
@@ -64,7 +59,7 @@ class Collection
   end
   
   def to_json(*a)
-    self.to_hash.to_json(*a)
+    Yajl::Encoder.encode(self.to_hash, *a)
   end
   
 end
index abeeeb9..7a61a61 100644 (file)
@@ -6,12 +6,7 @@ begin
 rescue LoadError
   warn "WARNING: edi4r-tdid not found. Only EDIFACT versions d96a and d01b will be supported!"
 end
-begin
-  require 'json/pure'
-rescue LoadError
-  warn "WARNING: json-pure not found. Trying json."
-  require 'json'
-end
+require 'yajl'
 
 class String
   
@@ -103,7 +98,7 @@ module EDI::E
     end
     
     def self.from_json(json, ic_opts = {})
-      struct = JSON.parse(json)
+      struct = Yajl::Parser.parse(json)
 
       json_opts = {}
       [:sender,:recipient].each { |party|
index ad4bd22..9cdac4c 100644 (file)
@@ -3,7 +3,7 @@ require 'edi/mapper'
 module OpenILS
   
   class Mapper < EDI::E::Mapper
-    VERSION = '0.9.8'
+    VERSION = '0.9.9'
   end
   
 end
index 76a19ba..5ea85c2 100644 (file)
@@ -3,6 +3,7 @@ begin
   $: << File.join(File.dirname(__FILE__),'lib')
   require 'openils/mapper'
   Gem::Specification.new do |s|
+    s.homepage = 'http://github.com/mbklein/openils-mapper'
     s.name = "openils-mapper"
     s.version = OpenILS::Mapper::VERSION
     s.summary = "EDIFACT<->JSON middleware for the Evergreen Open Source ILS"
@@ -14,7 +15,7 @@ begin
     s.rdoc_options << '--main' << 'README.rdoc'
     s.add_dependency 'edi4r', '>= 0.9.4'
     s.add_dependency 'edi4r-tdid', '>= 0.6.5'
-    s.add_dependency 'json', '>= 1.1.3'
+    s.add_dependency 'yajl-ruby', '>= 0.7.7'
     s.add_development_dependency 'rcov', '>= 0.8.1'
     s.add_development_dependency 'rspec', '>= 1.2.2'
     s.add_development_dependency 'rake', '>= 0.8.0'