Class: CsvToSqlite::ArgumentHandlerService
- Inherits:
-
Object
- Object
- CsvToSqlite::ArgumentHandlerService
- Defined in:
- lib/argument_handler_service.rb
Instance Method Summary collapse
- #call ⇒ Object
- #empty ⇒ Object
- #help ⇒ Object
-
#initialize(argv) ⇒ ArgumentHandlerService
constructor
A new instance of ArgumentHandlerService.
Constructor Details
#initialize(argv) ⇒ ArgumentHandlerService
Returns a new instance of ArgumentHandlerService.
4 5 6 |
# File 'lib/argument_handler_service.rb', line 4 def initialize argv @argv = argv end |
Instance Method Details
#call ⇒ Object
8 9 10 11 12 |
# File 'lib/argument_handler_service.rb', line 8 def call return empty if @argv.empty? return help if @argv.include? "-h" :convert end |
#empty ⇒ Object
24 25 26 27 |
# File 'lib/argument_handler_service.rb', line 24 def empty puts "Run 'csv_to_sqlite -h' to receive some help or csv_to_sqlite csv_file.csv to generate a SQLite3 database from a csv file." nil end |
#help ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/argument_handler_service.rb', line 14 def help puts "Run csv_lto_sqlite3 is easy!" puts "To convert a csv file into a sqlite3 database you just need to run the follow command from the same directory of the csv file:" puts "csv_to_sqlite your_csv_file.csv" puts "===============================" puts "-t <table-name> -> parameter used to set wich table will be created/used" puts "Some customisations will be aviable on next versions :)" nil end |