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

Active Model #9

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix file name in script
Animesh-Ghosh committed Apr 24, 2023
commit 230bcabc40e32ac55c44c77d1288518fa6c51944
9 changes: 6 additions & 3 deletions active_model/solution.rb
Original file line number Diff line number Diff line change
@@ -52,7 +52,10 @@ def initialize(file_name)
def call
@users = mapped_users
@invalid_users = scan_invalid_users
return unless @invalid_users.size.positive?
unless @invalid_users.size.positive?
puts "#{@file_name} is valid!"
return @users
end

puts "Invalid rows found in CSV #{@file_name}!"
@invalid_users.each do |index, invalid_user|
@@ -82,6 +85,6 @@ def scan_invalid_users
end

if __FILE__ == $0
UserCSVValidator.call('good_users.csv')
UserCSVValidator.call('bad_users.csv')
UserCSVValidator.call('misc/good_users.csv')
UserCSVValidator.call('misc/bad_users.csv')
end