Skip to content

Commit 8c2f83c

Browse files
committed
Merge pull request #1124 from marshall-lee/remove_ordered_hash
Remove `ActiveSupport::OrderedHash` usage.
2 parents c8b657e + 99fabb8 commit 8c2f83c

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

lib/grape.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
require 'set'
1010
require 'active_support/version'
1111
require 'active_support/core_ext/hash/indifferent_access'
12-
require 'active_support/ordered_hash'
1312
require 'active_support/core_ext/object/blank'
1413
require 'active_support/core_ext/array/extract_options'
1514
require 'active_support/core_ext/hash/deep_merge'

lib/grape/dsl/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def unset_description_field(field)
9898
# Merge multiple layers of settings into one hash.
9999
def stacked_hash_to_hash(settings)
100100
return nil if settings.nil? || settings.blank?
101-
settings.each_with_object(ActiveSupport::OrderedHash.new) { |value, result| result.deep_merge!(value) }
101+
settings.each_with_object({}) { |value, result| result.deep_merge!(value) }
102102
end
103103

104104
# Returns an object which configures itself via an instance-context DSL.

lib/grape/util/content_types.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
module Grape
22
module ContentTypes
33
# Content types are listed in order of preference.
4-
CONTENT_TYPES = ActiveSupport::OrderedHash[
5-
:xml, 'application/xml',
6-
:serializable_hash, 'application/json',
7-
:json, 'application/json',
8-
:binary, 'application/octet-stream',
9-
:txt, 'text/plain'
10-
]
4+
CONTENT_TYPES = {
5+
xml: 'application/xml',
6+
serializable_hash: 'application/json',
7+
json: 'application/json',
8+
binary: 'application/octet-stream',
9+
txt: 'text/plain'
10+
}
1111

1212
def self.content_types_for_settings(settings)
1313
return nil if settings.nil? || settings.blank?
1414

15-
settings.each_with_object(ActiveSupport::OrderedHash.new) { |value, result| result.merge!(value) }
15+
settings.each_with_object({}) { |value, result| result.merge!(value) }
1616
end
1717

1818
def self.content_types_for(from_settings)

spec/grape/api_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2812,10 +2812,10 @@ def serializable_hash
28122812
end
28132813
it 'hash' do
28142814
subject.get '/example' do
2815-
ActiveSupport::OrderedHash[
2816-
:example1, 'example1',
2817-
:example2, 'example2'
2818-
]
2815+
{
2816+
example1: 'example1',
2817+
example2: 'example2'
2818+
}
28192819
end
28202820
get '/example'
28212821
expect(last_response.status).to eq(200)

0 commit comments

Comments
 (0)