Skip to content

Commit 526f5f2

Browse files
author
Michael Bleigh
committed
Make requirement mapper an Array to preserve order in pre 1.9
1 parent caced0c commit 526f5f2

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

lib/multi_json.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ def engine
88
@engine
99
end
1010

11-
DefaultByRequire = {
12-
"yajl" => :yajl,
13-
"json" => :json_gem,
14-
"active_support" => :active_support,
15-
"json/pure" => :json_pure
16-
}
11+
REQUIREMENT_MAP = [
12+
["yajl", :yajl],
13+
["json", :json_gem],
14+
["active_support", :active_support],
15+
["json/pure", :json_pure]
16+
]
1717

1818
# The default engine based on what you currently
1919
# have loaded and installed. First checks to see
@@ -24,7 +24,7 @@ def default_engine
2424
return :json_gem if defined?(::JSON)
2525
return :active_support if defined?(::ActiveSupport::JSON)
2626

27-
DefaultByRequire.each_pair do |library, engine|
27+
REQUIREMENT_MAP.each do |(library, engine)|
2828
begin
2929
require library
3030
return engine

0 commit comments

Comments
 (0)