Skip to content

Commit

Permalink
Fix attribute translator setter
Browse files Browse the repository at this point in the history
This was simply not working before.
  • Loading branch information
Jell committed Dec 20, 2023
1 parent bc1d790 commit e195beb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/grape/router/attribute_translator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ def to_h
end

def method_missing(method_name, *args)
if setter?(method_name[-1])
attributes[method_name[0..]] = *args
if setter?(method_name)
attributes[method_name.chomp("=")] = *args
else
attributes[method_name]
end
end

def respond_to_missing?(method_name, _include_private = false)
if setter?(method_name[-1])
if setter?(method_name)
true
else
@attributes.key?(method_name)
Expand All @@ -56,7 +56,7 @@ def respond_to_missing?(method_name, _include_private = false)
private

def setter?(method_name)
method_name[-1] == '='
method_name.end_with?("=")
end
end
end
Expand Down

0 comments on commit e195beb

Please sign in to comment.