fide_xml_parser 0.1.0 → 0.2.0

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
  SHA256:
3
- metadata.gz: 67692b8c9fd3d78f38dd2dd37f3fa2de2586bfe70ba71f6be08fd0db0654383b
4
- data.tar.gz: e55d84d2b2b6df2680dc646a9a873d969f909fc96c9b9d0526e979cddaebaec8
3
+ metadata.gz: 706820b647cf190a5e17304d1cb22c7af1921b8e84f4310cc1dee6061de51f57
4
+ data.tar.gz: d64a2a33a80963bd30a7881393333f6464e1bee3b622e3e48a5831e7e0450b4f
5
5
  SHA512:
6
- metadata.gz: ad8ac8524c1d89227b084df75ad505b98863e404af7d6f853ee29641cdda37e97be655ec68687c46e601f825b52ad8656e2c6fa0a13f9487cc56e61e62b752da
7
- data.tar.gz: 92bf11de84011190588baef367d8512585b5b8a04e68c209a86b827d20aa3ddd0c6401e715e2b88473aa368bae9ce4b7a0f690eb49019444e8924ceaacbf345d
6
+ metadata.gz: 4515194fdf260fac89050ad6216069cdeb26a3516f5e6837e597d2af24fcad89bb6829a4a6602d02ddb9f12bb90a7d67b50c61ee35afbc5b6841654e81154f58
7
+ data.tar.gz: 667235af5570310f71120607ae937102162121a0e4bd2075d86b1cb731b0c6622f6d36c76ce721735164f2e0488a17748c7386352ea5aab26e5d928836c886fe
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
- # 0.1.0
1
+ ### 0.1.0
2
2
 
3
3
  First release.
4
4
 
5
+ ### 0.2.0
6
+
7
+ * API change: change last 2 write method arguments to keyword arguments.
@@ -32,22 +32,22 @@ class JsonWriter
32
32
  # To write multiple files, pass an array of filespecs as the `input_filespecs` parameter
33
33
  # json_mode: :pretty for human readable JSON, :compact for compact JSON
34
34
  # Default json_filespec will be constructed from the input file, just replacing 'xml' with 'json'.
35
- def write(input_filespec, json_mode = :pretty, json_filespec = nil)
35
+ def write(input_filespec, json_mode: :pretty, json_filespec: nil)
36
36
  if input_filespec.is_a?(Array)
37
37
  raise Error.new("This method is used only for single files, use write_multiple for multiple files.")
38
38
  end
39
39
 
40
40
  validate_input_filespecs(Array[input_filespec])
41
- write_private(input_filespec, json_mode, json_filespec)
41
+ write_private(input_filespec, json_mode: json_mode, json_filespec: json_filespec)
42
42
  end
43
43
 
44
44
 
45
45
  # Public entry point to write multiple files.
46
46
  # json_mode: :pretty for human readable JSON, :compact for compact JSON
47
- def write_multiple(input_filespecs, json_mode = :pretty)
47
+ def write_multiple(input_filespecs, json_mode: :pretty)
48
48
  validate_input_filespecs(input_filespecs)
49
49
  input_filespecs.each do |input_filespec|
50
- write_private(input_filespec, json_mode)
50
+ write_private(input_filespec, json_mode: json_mode)
51
51
  end
52
52
  end
53
53
 
@@ -56,12 +56,11 @@ class JsonWriter
56
56
  # Separated from the public `write` method in order to validate filespecs only once.
57
57
  # Default json_filespec will be constructed from the input file, just replacing 'xml' with 'json'.
58
58
  private
59
- def write_private(input_filespec, json_mode = :pretty, json_filespec = nil)
59
+ def write_private(input_filespec, json_mode: :pretty, json_filespec: nil)
60
60
  @parser = FideXmlParser::Processor.new
61
61
  parser.key_filter = key_filter
62
62
  parser.record_filter = record_filter
63
63
  records = parser.parse(File.new(input_filespec))
64
-
65
64
  json_text = (json_mode == :pretty) ? JSON.pretty_generate(records) : records.to_json
66
65
  json_filespec ||= input_filespec.sub(/\.xml$/, '.json')
67
66
  File.write(json_filespec, json_text)
@@ -1,3 +1,3 @@
1
1
  module FideXmlParser
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fide_xml_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Bennett
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-27 00:00:00.000000000 Z
11
+ date: 2020-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  requirements: []
154
- rubygems_version: 3.1.2
154
+ rubygems_version: 3.0.6
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Parses XML files downloaded from fide.com and writes JSON files.