File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 7
7
* [ #2575 ] ( https://github.com/ruby-grape/grape/pull/2575 ) : Refactor Api description class - [ @ericproulx ] ( https://github.com/ericproulx ) .
8
8
* [ #2577 ] ( https://github.com/ruby-grape/grape/pull/2577 ) : Deprecate ` return ` in endpoint execution - [ @ericproulx ] ( https://github.com/ericproulx ) .
9
9
* [ #2580 ] ( https://github.com/ruby-grape/grape/pull/2580 ) : Refactor endpoint helpers and error middleware integration - [ @ericproulx ] ( https://github.com/ericproulx ) .
10
+ * [ #2581 ] ( https://github.com/ruby-grape/grape/pull/2581 ) : Delegate ` to_s ` in Grape::API::Instance - [ @ericproulx ] ( https://github.com/ericproulx ) .
10
11
* [ #2582 ] ( https://github.com/ruby-grape/grape/pull/2582 ) : Fix leaky slash when normalizing - [ @ericproulx ] ( https://github.com/ericproulx ) .
11
12
* Your contribution here.
12
13
Original file line number Diff line number Diff line change @@ -19,11 +19,16 @@ class Instance
19
19
Boolean = Grape ::API ::Boolean
20
20
21
21
class << self
22
+ extend Forwardable
22
23
attr_reader :instance , :base
23
24
attr_accessor :configuration
24
25
26
+ def_delegators :base , :to_s
27
+
25
28
def given ( conditional_option , &block )
26
- evaluate_as_instance_with_configuration ( block , lazy : true ) if conditional_option && block
29
+ return unless conditional_option
30
+
31
+ mounted ( &block )
27
32
end
28
33
29
34
def mounted ( &block )
@@ -35,10 +40,6 @@ def base=(grape_api)
35
40
grape_api . instances << self
36
41
end
37
42
38
- def to_s
39
- base &.to_s || super
40
- end
41
-
42
43
def base_instance?
43
44
self == base . base_instance
44
45
end
You can’t perform that action at this time.
0 commit comments