Skip to content

Commit 783e834

Browse files
committed
Enable to autoload Util::Registrable
1 parent 6e7e7b0 commit 783e834

File tree

5 files changed

+35
-37
lines changed

5 files changed

+35
-37
lines changed

lib/grape.rb

+23-22
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,6 @@ module Exceptions
7777
autoload :MethodNotAllowed
7878
end
7979

80-
module ErrorFormatter
81-
extend ActiveSupport::Autoload
82-
autoload :Base
83-
autoload :Json
84-
autoload :Txt
85-
autoload :Xml
86-
end
87-
88-
module Formatter
89-
extend ActiveSupport::Autoload
90-
autoload :Json
91-
autoload :SerializableHash
92-
autoload :Txt
93-
autoload :Xml
94-
end
95-
96-
module Parser
97-
extend ActiveSupport::Autoload
98-
autoload :Json
99-
autoload :Xml
100-
end
101-
10280
module Middleware
10381
extend ActiveSupport::Autoload
10482
autoload :Base
@@ -130,6 +108,29 @@ module Util
130108
autoload :StackableValues
131109
autoload :InheritableSetting
132110
autoload :StrictHashConfiguration
111+
autoload :Registrable
112+
end
113+
114+
module ErrorFormatter
115+
extend ActiveSupport::Autoload
116+
autoload :Base
117+
autoload :Json
118+
autoload :Txt
119+
autoload :Xml
120+
end
121+
122+
module Formatter
123+
extend ActiveSupport::Autoload
124+
autoload :Json
125+
autoload :SerializableHash
126+
autoload :Txt
127+
autoload :Xml
128+
end
129+
130+
module Parser
131+
extend ActiveSupport::Autoload
132+
autoload :Json
133+
autoload :Xml
133134
end
134135

135136
module DSL

lib/grape/error_formatter.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
require 'grape/util/registrable'
2-
31
module Grape
42
module ErrorFormatter
5-
extend Registrable
3+
extend Util::Registrable
4+
65
class << self
76
def builtin_formatters
87
@builtin_formatters ||= {

lib/grape/formatter.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
require 'grape/util/registrable'
2-
31
module Grape
42
module Formatter
5-
extend Registrable
3+
extend Util::Registrable
64

75
class << self
86
def builtin_formmaters

lib/grape/parser.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
require 'grape/util/registrable'
2-
31
module Grape
42
module Parser
5-
extend Registrable
3+
extend Util::Registrable
64

75
class << self
86
def builtin_parsers

lib/grape/util/registrable.rb

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
module Grape
2-
module Registrable
3-
def default_elements
4-
@default_elements ||= {}
5-
end
2+
module Util
3+
module Registrable
4+
def default_elements
5+
@default_elements ||= {}
6+
end
67

7-
def register(format, element)
8-
default_elements[format] = element unless default_elements[format]
8+
def register(format, element)
9+
default_elements[format] = element unless default_elements[format]
10+
end
911
end
1012
end
1113
end

0 commit comments

Comments
 (0)