DataParser
DataParser is a simple gem for parsing a json file with search capabilty for partial or full name and displaying of duplicate email if there are.
NOTE: Later on it can extend to process other file type like csv, pdf, text file.
Prerequisites
Installation
Install from source:
gem "data_parser", :git => "git://github.com/rolandoalvarado/data_parser.git"
Install as RubyGem:
gem install data_parser
Install in your Rails application:
gem 'data_parser', '~> 0.1.0'
Usage
Searching for Partial or Full Name:
path = '<json file path>'
full_name = 'Mich'
result = DataParser.parse(path:).process(params: { full_name: }).names
[
{
"id": 4,
"full_name": "Michael Williams",
"email": "michael.williams@outlook.com"
},
{
"id": 10,
"full_name": "Michael Brown",
"email": "michael.brown@inbox.com"
}
]
Showing for duplicate email:
path = '<json file path>'
result = DataParser.parse(path:).process.emails
[
"jane.smith@example.com"
]
Using in a Ruby File:
- Add this to your code:
require_relative 'lib/data_parser.rb'
- Make ruby file executable
chmod +x bin/data_parser_runner.rb
- Execute the file:
./bin/data_parser_runner.rb
Running the test:
rake test
License
See LICENSE for details.