forked from tmm1/sinbook
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamically load json library (add compatibility with appengine-jruby)
- Loading branch information
Showing
2 changed files
with
15 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c18f024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better to do inside the class:
begin
require 'yajl'
def self.encode(v)
Yajl::Encoder.encode(v)}
end
rescue LoadError
require 'json'
def self.encode(v)
JSON.generate(v)
end
end
this way the code will be cleaner, IMHO.
c18f024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a real quick hack as an excuse :)
much cleaner I'd say :)