vdf 1.0.3 → 1.0.4

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
  SHA256:
3
- metadata.gz: ea8791384e1412acbaf3adb8e3d6c927b551beffa7ca464d0c13d2afc09f3467
4
- data.tar.gz: 31b28036937bf19217f598c7c59614448af11e4f7d70e6c4fb1f72d948252deb
3
+ metadata.gz: b09553948168a9e3a055f63ee948f6d2e49af1642f09709d92aa291002aabb6d
4
+ data.tar.gz: 3c215b4a6882176225f78f15ab14a6f8ea0e66ff2a3baccf8e84519dab417184
5
5
  SHA512:
6
- metadata.gz: 961a27599e581e3ce2452a74833ac5b67d89d23d4eb98454602b6c33533c2102468ba80661543ea08468b47de2328de23b1931300c3d013b98e8323debd95038
7
- data.tar.gz: 63d5f33713c9ad9f9d32c32f6b3f75ab90661ff48b286e463392390720daf05ad23c078d17b0bdc2e07e57c66b49c31c877d5cdc780819a47749cc73fb80fb32
6
+ metadata.gz: 658ffa731e7e7b7c1fd3d580209f374c763947618574e77a857cacdac2fc064a4b24ff0150faab88d1c9a914f308cfdc8e382c2356e99f325c91e6582fe8a956
7
+ data.tar.gz: 4926aa6b5a74f289944125caee6bff214858ee118fc1bcef7682c639558f9cc92a9543cf8a9b1a85cc97bc04d4375e3d3f9456fb6ed79266125b44030ff02994
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # VDF
2
2
 
3
3
  [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fsapphyrus%2Fvdf%2Fbadge&style=flat)](https://actions-badge.atrox.dev/sapphyrus/vdf/goto)
4
+ [![GitHub issues](https://img.shields.io/github/issues/sapphyrus/vdf)](https://github.com/sapphyrus/vdf/issues)
4
5
  [![Gem](https://img.shields.io/gem/v/vdf?color=%23E9573F)](https://rubygems.org/gems/vdf)
5
6
  [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](https://rubydoc.info/gems/vdf)
6
- [![GitHub issues](https://img.shields.io/github/issues/sapphyrus/vdf)](https://github.com/sapphyrus/vdf/issues)
7
7
  [![License](https://img.shields.io/github/license/sapphyrus/vdf)](https://github.com/sapphyrus/vdf/blob/master/LICENSE.txt)
8
8
 
9
9
  VDF is a gem to convert Valve's KeyValue format to Ruby hashes and back, based on the excellent [node-steam/vdf](https://github.com/node-steam/vdf)
@@ -68,6 +68,20 @@ puts VDF.generate(object)
68
68
 
69
69
  ```
70
70
 
71
+ If you're dealing with parsing large files, you should avoid loading them into memory completely. This library supports parsing a VDF file from a File object like this:
72
+ ```ruby
73
+ require "vdf"
74
+
75
+ # Open the file in read mode and parse it.
76
+ parsed = File.open("filename.vdf", "r") do |file|
77
+ VDF.parse(file)
78
+ end
79
+
80
+ # Pretty-print the result
81
+ p parsed
82
+
83
+ ```
84
+
71
85
  ## Performance comparison
72
86
 
73
87
  Small VDF File
@@ -37,7 +37,7 @@ module VDF
37
37
  expect = false
38
38
  i = 0
39
39
 
40
- enum = input.each_line.lazy
40
+ enum = input.each_line
41
41
  enum.with_index do |line, _|
42
42
  i += 1
43
43
  line.encode!("UTF-8").strip!
@@ -47,7 +47,7 @@ module VDF
47
47
  expect = false
48
48
  next
49
49
  elsif expect
50
- raise ParserError, "Invalid syntax on line #{i+1} (Expected identifier)"
50
+ raise ParserError, "Invalid syntax on line #{i+1} (Expected bracket)"
51
51
  end
52
52
 
53
53
  if line.start_with?(-'}')
@@ -104,6 +104,8 @@ module VDF
104
104
  end
105
105
  end
106
106
 
107
+ raise ParserError, "Open parentheses somewhere" unless stack.length == 1
108
+
107
109
  return result
108
110
  end
109
111
  end
@@ -1,4 +1,4 @@
1
1
  module VDF
2
2
  # The current version
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
@@ -12,8 +12,15 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = "https://github.com/sapphyrus/vdf"
13
13
  spec.license = "MIT"
14
14
 
15
+ spec.description = <<-EOF
16
+ VDF is a gem to convert Valve's KeyValue format to Ruby hashes and create a VDF string from a Ruby hash.
17
+ It's based on the excellent node-steam/vdf JS library and it's optimized for performance
18
+ EOF
19
+
15
20
  spec.metadata["homepage_uri"] = spec.homepage
16
21
  spec.metadata["source_code_uri"] = "https://github.com/sapphyrus/vdf"
22
+ spec.metadata["bug_tracker_uri"] = "https://github.com/sapphyrus/vdf/issues"
23
+ spec.metadata["documentation_uri"] = "https://www.rubydoc.info/gems/vdf"
17
24
 
18
25
  # Specify which files should be added to the gem when it is released.
19
26
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sapphyrus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-27 00:00:00.000000000 Z
11
+ date: 2019-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,7 +24,9 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
- description:
27
+ description: |2
28
+ VDF is a gem to convert Valve's KeyValue format to Ruby hashes and create a VDF string from a Ruby hash.
29
+ It's based on the excellent node-steam/vdf JS library and it's optimized for performance
28
30
  email:
29
31
  - phil5686@gmail.com
30
32
  executables: []
@@ -46,6 +48,8 @@ licenses:
46
48
  metadata:
47
49
  homepage_uri: https://github.com/sapphyrus/vdf
48
50
  source_code_uri: https://github.com/sapphyrus/vdf
51
+ bug_tracker_uri: https://github.com/sapphyrus/vdf/issues
52
+ documentation_uri: https://www.rubydoc.info/gems/vdf
49
53
  post_install_message:
50
54
  rdoc_options: []
51
55
  require_paths: