Skip to content

Commit e195beb

Browse files
committed
Fix attribute translator setter
This was simply not working before.
1 parent bc1d790 commit e195beb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/grape/router/attribute_translator.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ def to_h
3838
end
3939

4040
def method_missing(method_name, *args)
41-
if setter?(method_name[-1])
42-
attributes[method_name[0..]] = *args
41+
if setter?(method_name)
42+
attributes[method_name.chomp("=")] = *args
4343
else
4444
attributes[method_name]
4545
end
4646
end
4747

4848
def respond_to_missing?(method_name, _include_private = false)
49-
if setter?(method_name[-1])
49+
if setter?(method_name)
5050
true
5151
else
5252
@attributes.key?(method_name)
@@ -56,7 +56,7 @@ def respond_to_missing?(method_name, _include_private = false)
5656
private
5757

5858
def setter?(method_name)
59-
method_name[-1] == '='
59+
method_name.end_with?("=")
6060
end
6161
end
6262
end

0 commit comments

Comments
 (0)