Skip to content

Commit

Permalink
optimize dynamic attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Giallombardo Nathan committed Aug 14, 2024
1 parent c1718b8 commit 35bca06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/couchbase-orm/attributes/dynamic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module AttributesDynamic
#
# @return [ true | false ] True if it does, false if not.
def respond_to?(name, include_private = false)
super || attributes&.key?(name.to_s.reader)
super || has_attribute?(name.to_s.reader)
end

private
Expand Down Expand Up @@ -114,7 +114,7 @@ def define_dynamic_writer(name)
# @return [ Object ] The result of the method call.
def method_missing(name, *args)
attr = name.to_s
return super unless attr.reader != 'id' && attributes.key?(attr.reader)
return super unless attr.reader != 'id' && has_attribute?(attr.reader)

getter = attr.reader
if attr.writer?
Expand Down

0 comments on commit 35bca06

Please sign in to comment.