Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix Naming/MemoizedInstanceVariableName offenses #49

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .rubocop_todo.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/hawk/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def build_request_options_from(method, options)
end

def typhoeus_defaults
@_typhoeus_defaults ||= options_for_typhoeus(defaults).freeze
@typhoeus_defaults ||= options_for_typhoeus(defaults).freeze
end

def options_for_typhoeus(hawk_options)
Expand Down
4 changes: 2 additions & 2 deletions lib/hawk/model/association.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def inherited(subclass)
# the association's name and returns it, deleting it from the repr.
#
def preload_association(&block)
@_preload_association = block if block
@_preload_association ||= lambda do |scope, attributes|
@preload_association = block if block
@preload_association ||= lambda do |scope, attributes|
if scope.associations?
scope.associations.each_key do |name|
attr = name.to_s
Expand Down
2 changes: 1 addition & 1 deletion lib/hawk/model/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module ClassMethods
include SharedMethods

def connection
@_connection ||= begin
@connection ||= begin
raise Error::Configuration, "URL for #{name} is not yet set" unless url
raise Error::Configuration, 'Please set the client_name' unless client_name

Expand Down
20 changes: 10 additions & 10 deletions lib/hawk/model/finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,19 @@ def instantiate_one(repr, params)
end

def instance_key
@_instance_key ||= name.demodulize.underscore
@instance_key ||= name.demodulize.underscore
end

def collection_key
@_collection_key = instance_key.pluralize
@collection_key = instance_key.pluralize
end

def total_count_key
@_total_count_key = 'total_count'
@total_count_key = 'total_count'
end

def count_key
@_count_key = 'count'
@count_key = 'count'
end

def limit_param
Expand All @@ -123,22 +123,22 @@ def model_path(path = nil)
raise Error::Configuration, "Hawk's Base class doesn't have any path"
end

@_model_path = path if path
@_model_path ||= default_model_path
@model_path = path if path
@model_path ||= default_model_path
end

def default_model_path
name.demodulize.underscore.pluralize.freeze
end

def batch_path(path = nil)
@_batch_path = path if path
@_batch_path ||= 'batch'
@batch_path = path if path
@batch_path ||= 'batch'
end

def count_path(path = nil)
@_count_path = path if path
@_count_path ||= 'count'
@count_path = path if path
@count_path ||= 'count'
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/hawk/model/querying.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def all(params = {})
end

def default_params(params = nil)
@_default_params = params if params
@_default_params ||= {}
@default_params = params if params
@default_params ||= {}
end

# Adds +limit+ with the given number of records
Expand Down
Loading