vdf 1.0.4 → 1.0.5

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: b09553948168a9e3a055f63ee948f6d2e49af1642f09709d92aa291002aabb6d
4
- data.tar.gz: 3c215b4a6882176225f78f15ab14a6f8ea0e66ff2a3baccf8e84519dab417184
3
+ metadata.gz: 5061239d0e55f0aec46fcde2f175862500ed7d5c25af67a0842e030cb97d90f7
4
+ data.tar.gz: 82198cb9b25f2345e450f8d2a2734ff66495b0c645512fcceb7fee8e96607c4f
5
5
  SHA512:
6
- metadata.gz: 658ffa731e7e7b7c1fd3d580209f374c763947618574e77a857cacdac2fc064a4b24ff0150faab88d1c9a914f308cfdc8e382c2356e99f325c91e6582fe8a956
7
- data.tar.gz: 4926aa6b5a74f289944125caee6bff214858ee118fc1bcef7682c639558f9cc92a9543cf8a9b1a85cc97bc04d4375e3d3f9456fb6ed79266125b44030ff02994
6
+ metadata.gz: bb1542c98373562ca7c23799eb3c9b5b7e0a1a6e07e3b7c4b595cefa55f51953e865eb286ba6fdd0bd60efce11e919f7844acdb110ec28e2969e71a8b72bf328
7
+ data.tar.gz: 7e87b0dbda7edde4a33371b907ea2cef21e6c91c3c1e30928dbf8e7e13d54270e781bbee8d09a004dffb3658144be0334c994d2c6cc8fd6f206072189927b4fa
@@ -0,0 +1,12 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "11:00"
8
+ open-pull-requests-limit: 10
9
+ - package-ecosystem: github-actions
10
+ directory: "/"
11
+ schedule:
12
+ interval: weekly
@@ -14,11 +14,12 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
 
16
16
  steps:
17
- - uses: actions/checkout@master
18
- - name: Set up Ruby 2.6
19
- uses: actions/setup-ruby@v1
17
+ - uses: actions/checkout@v4
18
+ - name: Set up Ruby
19
+ uses: ruby/setup-ruby@v1
20
20
  with:
21
- version: 2.6.x
21
+ ruby-version: 3.4
22
+ bundler-cache: true
22
23
 
23
24
  - name: Publish to GPR
24
25
  run: |
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Phil
3
+ Copyright (c) 2025 Phil
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -68,7 +68,7 @@ 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:
71
+ If you're dealing with parsing large files, you should avoid loading them into memory fully. This library supports parsing a VDF file from a File object like this:
72
72
  ```ruby
73
73
  require "vdf"
74
74
 
@@ -106,7 +106,7 @@ The latest version of this library can be downloaded at
106
106
 
107
107
  * https://rubygems.org/gems/vdf
108
108
 
109
- Online Documentation should be located at
109
+ Online Documentation is located at
110
110
 
111
111
  * https://www.rubydoc.info/gems/vdf
112
112
 
data/lib/vdf/generate.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VDF
2
4
  # The Generator class is responsible for generating VDF documents from input hashes.
3
5
  # @see VDF.generate
@@ -9,7 +11,7 @@ module VDF
9
11
  # @param object [Hash] the input object
10
12
  # @return [String] the generated VDF document
11
13
  def generate(object)
12
- raise ArgumentError, "Object has to respond to each" unless object.respond_to? :each
14
+ raise ArgumentError, 'Object has to respond to each' unless object.respond_to? :each
13
15
 
14
16
  generate_impl(object, 0)
15
17
  end
@@ -17,14 +19,14 @@ module VDF
17
19
  private
18
20
 
19
21
  def generate_impl(object, level)
20
- result = ""
21
- indent = -"\t"*level
22
+ result = String.new
23
+ indent = "\t" * level
22
24
 
23
25
  object.each do |key, value|
24
26
  if value.respond_to? :each
25
- result << [indent, -'"', key, -"\"\n", indent, -"{\n", generate_impl(value, level + 1), indent, -"}\n"].join
27
+ result << [indent, '"', key, "\"\n", indent, "{\n", generate_impl(value, level + 1), indent, "}\n"].join
26
28
  else
27
- result << [indent, -'"', key, -'"', indent, indent, -'"', value.to_s, -"\"\n"].join
29
+ result << [indent, '"', key, '"', indent, indent, '"', value.to_s, "\"\n"].join
28
30
  end
29
31
  end
30
32
 
data/lib/vdf/parse.rb CHANGED
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'stringio'
4
+
1
5
  module VDF
2
6
  # The Parser class is responsible for parsing a VDF document into a Ruby Hash
3
7
  # @see VDF.parse
@@ -29,7 +33,7 @@ module VDF
29
33
  # puts contents.inspect
30
34
  # end
31
35
  def parse(input)
32
- raise ArgumentError, "Input has to respond to :each_line or :to_str" unless input.respond_to?(:each_line) || input.respond_to?(:to_str)
36
+ raise ArgumentError, 'Input has to respond to :each_line or :to_str' unless input.respond_to?(:each_line) || input.respond_to?(:to_str)
33
37
  input = StringIO.new(input) unless input.respond_to? :pos
34
38
 
35
39
  result = {}
@@ -40,17 +44,20 @@ module VDF
40
44
  enum = input.each_line
41
45
  enum.with_index do |line, _|
42
46
  i += 1
43
- line.encode!("UTF-8").strip!
44
- next if line.empty? || line[0] == -'/'
47
+ line.encode!('UTF-8').strip!
48
+ next if line.empty? || line[0] == '/'
45
49
 
46
- if line.start_with?(-'{')
50
+ if line.start_with?('{')
47
51
  expect = false
48
52
  next
49
53
  elsif expect
50
54
  raise ParserError, "Invalid syntax on line #{i+1} (Expected bracket)"
51
55
  end
52
56
 
53
- if line.start_with?(-'}')
57
+ if line.start_with?('}')
58
+ if stack.length == 1
59
+ raise ParserError, "Invalid syntax on line #{i} (Unexpected closing bracket)"
60
+ end
54
61
  stack.pop
55
62
  next
56
63
  end
@@ -76,7 +83,7 @@ module VDF
76
83
  end
77
84
 
78
85
  i += 1
79
- line << -"\n" << next_line.to_s.encode("UTF-8").strip
86
+ line << "\n" << next_line.to_s.encode("UTF-8").strip
80
87
  next
81
88
  end
82
89
 
@@ -85,14 +92,14 @@ module VDF
85
92
  Integer(val)
86
93
  rescue ArgumentError
87
94
  Float(val)
88
- end
89
- rescue ArgumentError
90
- case val.downcase
91
- when -"true"
95
+ end
96
+ rescue ArgumentError
97
+ case val.downcase
98
+ when 'true'
92
99
  true
93
- when -"false"
100
+ when 'false'
94
101
  false
95
- when -"null"
102
+ when 'null'
96
103
  nil
97
104
  else
98
105
  val
@@ -104,7 +111,7 @@ module VDF
104
111
  end
105
112
  end
106
113
 
107
- raise ParserError, "Open parentheses somewhere" unless stack.length == 1
114
+ raise ParserError, 'Open parentheses somewhere' unless stack.length == 1
108
115
 
109
116
  return result
110
117
  end
data/lib/vdf/version.rb CHANGED
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VDF
2
4
  # The current version
3
- VERSION = "1.0.4"
5
+ VERSION = '1.0.5'
4
6
  end
data/lib/vdf.rb CHANGED
@@ -1,6 +1,8 @@
1
- require "vdf/version"
2
- require "vdf/parse"
3
- require "vdf/generate"
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'vdf/version'
4
+ require_relative 'vdf/parse'
5
+ require_relative 'vdf/generate'
4
6
 
5
7
  # Main VDF module
6
8
  # @author sapphyrus
data/vdf.gemspec CHANGED
@@ -1,33 +1,33 @@
1
- lib = File.expand_path("lib", __dir__)
1
+ lib = File.expand_path('lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "vdf/version"
3
+ require 'vdf/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "vdf"
6
+ spec.name = 'vdf'
7
7
  spec.version = VDF::VERSION
8
- spec.authors = ["sapphyrus"]
9
- spec.email = ["phil5686@gmail.com"]
8
+ spec.authors = ['sapphyrus']
9
+ spec.email = ['phil5686@gmail.com']
10
10
 
11
- spec.summary = %q{Parses Valve's KeyValue format to Ruby Hashes and back}
12
- spec.homepage = "https://github.com/sapphyrus/vdf"
13
- spec.license = "MIT"
11
+ spec.summary = 'Parses Valve\'s KeyValue format to Ruby Hashes and back'
12
+ spec.homepage = 'https://github.com/sapphyrus/vdf'
13
+ spec.license = 'MIT'
14
14
 
15
15
  spec.description = <<-EOF
16
16
  VDF is a gem to convert Valve's KeyValue format to Ruby hashes and create a VDF string from a Ruby hash.
17
17
  It's based on the excellent node-steam/vdf JS library and it's optimized for performance
18
18
  EOF
19
19
 
20
- spec.metadata["homepage_uri"] = spec.homepage
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"
20
+ spec.metadata['homepage_uri'] = spec.homepage
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'
24
+
25
+ spec.required_ruby_version = '>= 2.5'
24
26
 
25
27
  # Specify which files should be added to the gem when it is released.
26
28
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
29
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
30
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
31
  end
30
- spec.require_paths = ["lib"]
31
-
32
- spec.add_development_dependency "bundler", "~> 2.0"
32
+ spec.require_paths = ['lib']
33
33
  end
metadata CHANGED
@@ -1,29 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - sapphyrus
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2019-09-16 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.0'
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
27
12
  description: |2
28
13
  VDF is a gem to convert Valve's KeyValue format to Ruby hashes and create a VDF string from a Ruby hash.
29
14
  It's based on the excellent node-steam/vdf JS library and it's optimized for performance
@@ -33,6 +18,7 @@ executables: []
33
18
  extensions: []
34
19
  extra_rdoc_files: []
35
20
  files:
21
+ - ".github/dependabot.yml"
36
22
  - ".github/workflows/gempush.yml"
37
23
  - ".gitignore"
38
24
  - LICENSE.txt
@@ -50,7 +36,6 @@ metadata:
50
36
  source_code_uri: https://github.com/sapphyrus/vdf
51
37
  bug_tracker_uri: https://github.com/sapphyrus/vdf/issues
52
38
  documentation_uri: https://www.rubydoc.info/gems/vdf
53
- post_install_message:
54
39
  rdoc_options: []
55
40
  require_paths:
56
41
  - lib
@@ -58,15 +43,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
43
  requirements:
59
44
  - - ">="
60
45
  - !ruby/object:Gem::Version
61
- version: '0'
46
+ version: '2.5'
62
47
  required_rubygems_version: !ruby/object:Gem::Requirement
63
48
  requirements:
64
49
  - - ">="
65
50
  - !ruby/object:Gem::Version
66
51
  version: '0'
67
52
  requirements: []
68
- rubygems_version: 3.0.3
69
- signing_key:
53
+ rubygems_version: 3.6.9
70
54
  specification_version: 4
71
55
  summary: Parses Valve's KeyValue format to Ruby Hashes and back
72
56
  test_files: []