Permalink
Browse files

Make requirement mapper an Array to preserve order in pre 1.9

  • Loading branch information...
1 parent caced0c commit 526f5f29a42131574a088ad9bbb43d7f48439b2c Michael Bleigh committed Jun 19, 2010
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/multi_json.rb
  2. 0 spec/{x_to_json_spec.rb → multi_json_spec.rb}
View
@@ -8,12 +8,12 @@ def engine
@engine
end
- DefaultByRequire = {
- "yajl" => :yajl,
- "json" => :json_gem,
- "active_support" => :active_support,
- "json/pure" => :json_pure
- }
+ REQUIREMENT_MAP = [
+ ["yajl", :yajl],
+ ["json", :json_gem],
+ ["active_support", :active_support],
+ ["json/pure", :json_pure]
+ ]
# The default engine based on what you currently
# have loaded and installed. First checks to see
@@ -24,7 +24,7 @@ def default_engine
return :json_gem if defined?(::JSON)
return :active_support if defined?(::ActiveSupport::JSON)
- DefaultByRequire.each_pair do |library, engine|
+ REQUIREMENT_MAP.each do |(library, engine)|
begin
require library
return engine
File renamed without changes.

0 comments on commit 526f5f2

Please sign in to comment.