embulk-parser-query_string 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: 7ac626f433219956351f1469cb10fcb04bc6d8f7
4
- data.tar.gz: 9867d72ed16d696d33a03c7221f7ca628ac9f50b
3
+ metadata.gz: 1d212e03f093b093ae862308c637069251feb71a
4
+ data.tar.gz: 968354927bcd4ab12998fe8c366e79e3613401bc
5
5
  SHA512:
6
- metadata.gz: 891c288a06ffff07142f4e12ad7ebbcb73d6b0c3811547d678f7b83a80a9790de7b2cf9fdbf8bf1b9bbe9afaf9dc1bded2d83a18d1c800b85d4c57328add6aa1
7
- data.tar.gz: 6dfc5c6461092a8fb5243c9b910a798b5a82c87fc9a71cc7612ecad3f2d91a7bb73a26ab0d14d2383a03a32ab449afb24bb62cc50fa0bbd63f0ae7c8c4ff6862
6
+ metadata.gz: 5e31e9f7e2675cf161686d05a4517bddeac6be16cc8eeb890c86257bff274077a8735060e8dd0d5a269a061497fec1b30a4e7b930b2f02c740a8f982be0ae12f
7
+ data.tar.gz: e5e3adfa549e74d627b6afa06acad1b30026811b0db9073cafaa63254156f16774ae00143dc6a9ba630f10fac6c2904d572b3d31adabfeaa4336b1efd5127416
@@ -1,3 +1,6 @@
1
+ ## 0.1.2 - 2015-07-14
2
+ * [fixed] Fix to ignore empty line same as invalid line [#14](https://github.com/treasure-data/embulk-parser-query_string/pull/14)
3
+
1
4
  ## 0.1.1 - 2015-07-14
2
5
  * [fixed] Add missing support capture option to parser [#13](https://github.com/treasure-data/embulk-parser-query_string/pull/13)
3
6
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-parser-query_string"
4
- spec.version = "0.1.1"
4
+ spec.version = "0.1.2"
5
5
  spec.authors = ["yoshihara", "uu59"]
6
6
  spec.summary = "Query String parser plugin for Embulk"
7
7
  spec.description = "Parses Query String files read by other file input plugins."
@@ -52,10 +52,12 @@ module Embulk
52
52
 
53
53
  def self.parse(line, options = {})
54
54
  if options[:capture]
55
- line = line.match(options[:capture]).to_a[1]
55
+ line = line.match(options[:capture]).to_a[1] || ""
56
56
  # TODO: detect incorrect regexp given
57
57
  end
58
- line.chomp!
58
+
59
+ return if line == ""
60
+
59
61
  line.strip! if options[:strip_whitespace]
60
62
  if options[:strip_quote]
61
63
  line = line[/\A(?:["'])?(.*?)(?:["'])?\z/, 1]
@@ -36,6 +36,16 @@ module Embulk
36
36
  assert_nil(result)
37
37
  end
38
38
 
39
+ def test_empty_line
40
+ result = QueryString.parse("")
41
+ assert_nil(result)
42
+ end
43
+
44
+ def test_empty_matched
45
+ result = QueryString.parse("foo=bar", capture: /foo/) # $1 is undefined, so treated as empty string
46
+ assert_nil(result)
47
+ end
48
+
39
49
  private
40
50
 
41
51
  def expected
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-parser-query_string
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
  - yoshihara