embulk-filter-query_string_ruby 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4aeade6f4753094282ffd227bdd6744354031e3
4
- data.tar.gz: fefd908aef8b4158969a281089dc05a500e9111e
3
+ metadata.gz: eee2562738fdd2b055730f0d52aa27615f793e1b
4
+ data.tar.gz: f71da22947098595d3a2205969ea445d799d86ad
5
5
  SHA512:
6
- metadata.gz: f452a31805bc5ac593ee86e95ff04df06808906e7de649c85db237d0c0c13e289fd08d81df9ea4fb2ac5271d603e6bc352970cf9d8ae1ca8fb0bbb9e2893fffc
7
- data.tar.gz: 6532f7cc6836ec40ff2a8b470a17dd561f8f2e83e205e3ddb56fcd662e3ccc85f3d544877fbe969cbd96e9ab091850499dff7d062958258e0d0bb41d0f3a237f
6
+ metadata.gz: 5fc30a1cda9076f1fc8d898fe886a472863cce64170a757f21b1e0e434fc827d99e904808f7921f7deffd0393823360f5f9e3faf004b5ee8a30272e5bbf6c39b
7
+ data.tar.gz: 355a4b6d38f97f41dc5d8ec79f00313c231d32ffb025d03b2f103dd46fbb3ac2206c02d775b1426a6ee1e26529896265a04715d3ef60c893e0d9a22ee0d9de04
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "embulk-filter-query_string_ruby"
4
- spec.version = "0.1.8"
4
+ spec.version = "0.1.9"
5
5
  spec.authors = ["Yuma Murata"]
6
6
  spec.summary = "Query String Ruby filter plugin for Embulk"
7
7
  spec.description = "Query String Ruby"
@@ -39,29 +39,36 @@ module Embulk
39
39
  private
40
40
 
41
41
  def query_parser(query_string)
42
- u = Addressable::URI.parse(query_string)
43
- uri = u.query ? u : Addressable::URI.parse("?#{query_string}")
44
- return uri.query_values(Hash)
42
+ begin
43
+ u = Addressable::URI.parse(query_string)
44
+ uri = u.query ? u : Addressable::URI.parse("?#{query_string}")
45
+ return uri.query_values(Hash)
46
+ rescue => e
47
+ Embulk.logger.warn("Parse failed '#{query_string}'")
48
+ end
45
49
  end
46
50
 
47
51
  def make_record(schema, query)
48
52
  return schema.map do |col|
49
53
  v = query[col["name"]]
50
- if !v.to_s.empty?
51
- begin
52
- case col["type"]
53
- when "long"
54
- Integer(v)
55
- when "double"
56
- Float(v)
57
- when "timestamp"
58
- Time.parse(v)
59
- else
60
- v.to_s
61
- end
62
- rescue => e
63
- Embulk.logger.warn("Cast failed '#{v}' as '#{col["type"]}' (query name is '#{col["name"]}')")
54
+
55
+ if v.to_s.empty?
56
+ next
57
+ end
58
+
59
+ begin
60
+ case col["type"]
61
+ when "long"
62
+ Integer(v)
63
+ when "double"
64
+ Float(v)
65
+ when "timestamp"
66
+ Time.parse(v)
67
+ else
68
+ v.to_s
64
69
  end
70
+ rescue => e
71
+ Embulk.logger.warn("Cast failed '#{v}' as '#{col["type"]}' (query name is '#{col["name"]}')")
65
72
  end
66
73
  end
67
74
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-filter-query_string_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuma Murata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-08 00:00:00.000000000 Z
11
+ date: 2017-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable