Skip to content

DataParser is a simple gem for parsing a json file with search capabilty for partial or full name and showing of duplicate email if there are.

License

Notifications You must be signed in to change notification settings

rolandoalvarado/data_parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

  1. Add this to your code:
require_relative 'lib/data_parser.rb'
  1. Make ruby file executable
chmod +x bin/data_parser_runner.rb
  1. Execute the file:
./bin/data_parser_runner.rb

Running the test:

rake test

License

See LICENSE for details.

About

DataParser is a simple gem for parsing a json file with search capabilty for partial or full name and showing of duplicate email if there are.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages