You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ruby-oembed gem currently relies on the xml-simple and json gems. It should allow for other parsing libraries to be either detected or specified. Libraries we should support:
XML
Hpricot
Nokogiri
JSON
Rails 3 JSON
Sugest even more in the comments.
The text was updated successfully, but these errors were encountered:
Hey @metavida, how about Oj? (I'm happy to have a stab at adding this.)
I'm using ruby-oembed in a non-Rails project right now, and it's failing with many JSON responses (esp. those coming from Twitter, but I haven't seen a clear pattern) unless I specifically require active_support/json, which I'm not terribly keen on doing.
Have you tried using the json gem instead of ActiveSupport's JSON? Either require "json" before you require ruby-oembed or call OEmbed::Formatter::JSON.backend = 'JSONGem'
I likely won't have time to implement support for Oj, but would be glad to review & merge in a pull request if you send one! You can use this class as inspiration. Really all you'll need is three public class methods! You can even start using your custom JSON formatter before I've officially merged it:
class MyOjFormatter
...
end
OEmbed::Formatter::JSON.backend = MyOjFormatter
I tried loading the json gem before loading ruby-oembed and got mixed results unfortunately -- I haven't had much luck in tracking down why this was, but it did work at some point, and then stopped. It's good to know that I can set the backend explicitly, I will try that next. Otherwise, maybe I'll find some time to cram Oj in there soon.
The ruby-oembed gem currently relies on the xml-simple and json gems. It should allow for other parsing libraries to be either detected or specified. Libraries we should support:
XML
JSON
Sugest even more in the comments.
The text was updated successfully, but these errors were encountered: