Skip to content

Commit

Permalink
Fix UtilityFunction reek smell
Browse files Browse the repository at this point in the history
I decided to just silence this warning, after fixing the method name...
because this doesn't feel right to move to somewhere else. The method
doesn't depend on object state but... it could. Or it could delegate to
a class method, but that feels too academic to worry about.
  • Loading branch information
Paul DobbinSchmaltz committed Sep 16, 2023
1 parent 83d0ef1 commit 5ced86c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/object_inspector/inspector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def formatter
end

# @return [String] if `key` is found in {#kargs} or if {@object} responds to
# `#{object_inspet_method_name}` (e.g. `inspect_flags`)
# `#{object_inspection_method_name}` (e.g. `inspect_flags`)
# @return [NilClass] if not found in {#kargs} or {@object}
def value(key:)
return_value =
Expand Down Expand Up @@ -147,13 +147,13 @@ def evaluate_passed_in_value(value)
# Attempt to call `inspect_*` on {@object} based on the passed in `name`.
#
# @return [String] if {@object} responds to
# `#{object_inspet_method_name}` (e.g. `inspect_flags`)
# `#{object_inspection_method_name}` (e.g. `inspect_flags`)
# @return [NilClass] if not found on {@object}
def interrogate_object_inspect_method(
name,
prefix: ObjectInspector.configuration.inspect_method_prefix)
interrogate_object(
method_name: object_inspet_method_name(name, prefix: prefix),
method_name: object_inspection_method_name(name, prefix: prefix),
kargs: object_method_keyword_arguments)
end

Expand All @@ -167,7 +167,8 @@ def interrogate_object(method_name:, kargs: {})
interrogator.call
end

def object_inspet_method_name(
# :reek:UtilityFunction
def object_inspection_method_name(
name,
prefix: ObjectInspector.configuration.inspect_method_prefix)
"#{prefix}_#{name}"
Expand Down

0 comments on commit 5ced86c

Please sign in to comment.