embulk-parser-query_string 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/embulk-parser-query_string.gemspec +1 -1
- data/lib/embulk/parser/query_string.rb +4 -2
- data/test/embulk/parser/test_query_string_plugin.rb +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d212e03f093b093ae862308c637069251feb71a
|
4
|
+
data.tar.gz: 968354927bcd4ab12998fe8c366e79e3613401bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e31e9f7e2675cf161686d05a4517bddeac6be16cc8eeb890c86257bff274077a8735060e8dd0d5a269a061497fec1b30a4e7b930b2f02c740a8f982be0ae12f
|
7
|
+
data.tar.gz: e5e3adfa549e74d627b6afa06acad1b30026811b0db9073cafaa63254156f16774ae00143dc6a9ba630f10fac6c2904d572b3d31adabfeaa4336b1efd5127416
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
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
|
-
|
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
|