harerun_parser 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0826aef4d97faf1f5b3363a7dce676e8a6ba1234
4
- data.tar.gz: 17f8a8789ddeaff0d4f046f54d34adffb0f36c4d
3
+ metadata.gz: 4f06a13c1697e76f079975802dd0b94a69106285
4
+ data.tar.gz: d8fd3780b41dfaf7890628dd9cf42cb387d1198a
5
5
  SHA512:
6
- metadata.gz: bd367c1ac90473895cf08124015b8ccea1d8c031bdd7438e656bb7dd7a8518f362bec5ed948c1401059f725f343f38cf6aa9bb376d54a3a7575edfe4e89bd5c0
7
- data.tar.gz: 424cd5d3cc780b379154f2bc2cac91bc1c1e33887917c6c19b10997556fc87fa70b220bab5282fd820794d02e933fcd68a39c236795f54a81823b51878941ca2
6
+ metadata.gz: 1f5d1789668d478f1cf8893c687e1595f38dd024b6484653b236ed904f7cbd9cf5a899cb126e9688c5a0bba4d65e3884e812e74664927f8fc6d76e0212e838a1
7
+ data.tar.gz: fe880c602bc7e51e6065418a786dd555bb3c155f71628f0a0b790a0e00d0a79d12e0370dc44dcb305c1f8b2050d46a10c94a38ed5d39831a011bd50d404a5239
@@ -3,16 +3,18 @@ require 'harerun_parser/parser'
3
3
 
4
4
  module HarerunParser
5
5
  class Command < Thor
6
- desc 'normalize INPUT OUTPUT', 'normalize download file'
7
- option :input, require: true
6
+ desc 'normalize INPUT_FILE_PATH [OUTPUT_FILE_PATH]', 'normalize download file'
8
7
  option :output, require: true
9
- def normalize()
10
- input_file = options[:input]
11
- output_file = options[:output]
12
-
8
+ def normalize(input_file, output_file=nil)
13
9
  File.open(input_file, 'r') do |f|
14
10
  harerun = HarerunParser::Parser.new(f)
15
- CSV.open(output_file, 'wb') do |csv|
11
+
12
+ if output_file.nil?
13
+ harerun.normalize do |day, place, header, value|
14
+ puts "#{day},#{place},#{header},#{value}"
15
+ end
16
+ else
17
+ csv = CSV.open(output_file, 'wb')
16
18
  harerun.normalize do |day, place, header, value|
17
19
  csv << [day, place, header, value]
18
20
  end
@@ -20,21 +22,15 @@ module HarerunParser
20
22
  end
21
23
  end
22
24
 
23
- option :input, require: true
24
- desc 'places', 'get places in csv file'
25
- def places()
26
- input_file = options[:input]
27
-
25
+ desc 'places INPUT_FILE_PATH', 'get places in csv file'
26
+ def places(input_file)
28
27
  File.open(input_file, 'r') do |f|
29
28
  p HarerunParser::Parser.new(f).places
30
29
  end
31
30
  end
32
31
 
33
- option :input, require: true
34
- desc 'headers', 'get headers in csv file'
35
- def headers()
36
- input_file = options[:input]
37
-
32
+ desc 'headers INPUT_FILE_PATH', 'get headers in csv file'
33
+ def headers(input_file )
38
34
  File.open(input_file, 'r') do |f|
39
35
  p HarerunParser::Parser.new(f).headers
40
36
  end
@@ -1,3 +1,3 @@
1
1
  module HarerunParser
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harerun_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "'ganta.viii'"