We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent caced0c commit 526f5f2Copy full SHA for 526f5f2
2 files changed
lib/multi_json.rb
@@ -8,12 +8,12 @@ def engine
8
@engine
9
end
10
11
- DefaultByRequire = {
12
- "yajl" => :yajl,
13
- "json" => :json_gem,
14
- "active_support" => :active_support,
15
- "json/pure" => :json_pure
16
- }
+ REQUIREMENT_MAP = [
+ ["yajl", :yajl],
+ ["json", :json_gem],
+ ["active_support", :active_support],
+ ["json/pure", :json_pure]
+ ]
17
18
# The default engine based on what you currently
19
# have loaded and installed. First checks to see
@@ -24,7 +24,7 @@ def default_engine
24
return :json_gem if defined?(::JSON)
25
return :active_support if defined?(::ActiveSupport::JSON)
26
27
- DefaultByRequire.each_pair do |library, engine|
+ REQUIREMENT_MAP.each do |(library, engine)|
28
begin
29
require library
30
return engine
spec/x_to_json_spec.rb spec/multi_json_spec.rbspec/x_to_json_spec.rb renamed to spec/multi_json_spec.rb
0 commit comments