Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Addressed Rubocop concerns from PR 29 #31

Merged
merged 1 commit into from
Sep 29, 2022
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
4 changes: 1 addition & 3 deletions lib/barcodevalidation/gtin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ def new(input)

# Adds the provided class to the back of the list of prioritized GTIN classes.
def append_gtin_class(gtin_class)
return if gtin_class?(gtin_class)

prioritized_gtin_classes.push(gtin_class)
prioritized_gtin_classes.push(gtin_class) unless gtin_class?(gtin_class)
nil
end

Expand Down
2 changes: 1 addition & 1 deletion lib/barcodevalidation/gtin/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def initialize(input)
# Does this class (potentially) handle a GTIN that matches the input?
# Subclasses can choose to implement their own logic. The default is to look at +VALID_LENGTH+ and use that to match the length of the input the class handles.
def self.handles?(input)
return false unless self.const_defined?(:VALID_LENGTH)
return false unless const_defined?(:VALID_LENGTH)

input.length == self::VALID_LENGTH
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/barcodevalidation/gtin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@

class_obj = Object.const_get(class_sym)
BarcodeValidation::GTIN.remove_gtin_class(class_obj)
Object.send(:remove_const, class_sym)
Object.__send__(:remove_const, class_sym)
end
end

Expand Down