yaml_store_unsafe_load 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 17ef1f5602090b780f2a615b4751fd8e3679b5191e7a09155f94d39182231beb
4
+ data.tar.gz: 840e7ceff599e3b021678e2fee0b6719b3b65053e1618870b1c0f945182d8e78
5
+ SHA512:
6
+ metadata.gz: 59ccfaf7da9b16aa805a40749f7b2893be3dfc5b7a2c500092d3178213adfa6007932645e458d469573d59ab8465e9c93867b30757c05fe0db523cbe71582115
7
+ data.tar.gz: a4382e00ed5534d15fd2febb090aee06fcd283c5f914a86de1d30cf31d55797960a888b30d086d470f6147a1de9baaf5efdc809c1f273f990ec28eb8fd6ad9a3
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # YamlStoreUnsafeLoad
2
+
3
+ yaml_store_unsafe_load - patch to use unsafe_load instead of safe_load in yaml/store
4
+
5
+ I created this to fix my app that uses yaml/store, which was broken in ruby 3.4. Since this is a patch that replaces a safe method with an unsafe method, you should fully understand what you are doing before using it.
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ ```bash
12
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
13
+ ```
14
+
15
+ If bundler is not being used to manage dependencies, install the gem by executing:
16
+
17
+ ```bash
18
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ #!/usr/bin/env ruby
25
+ require 'yaml/store'
26
+ require 'yaml_store_unsafe_load'
27
+
28
+ store = YAML::Store.new "test.store"
29
+ store.transaction do
30
+ store["now"] = Time.now
31
+ end
32
+
33
+ store.transaction do
34
+ p store["now"] # this gem prevent here from raising an exception in ruby3.4 (yaml 0.4.0)
35
+ end
36
+ ```
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/s3fxn/yaml_store_unsafe_load.
41
+
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YamlStoreUnsafeLoad
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "yaml_store_unsafe_load/version"
4
+
5
+ module YamlStoreUnsafeLoad
6
+ def load(content)
7
+ table = if YAML.respond_to?(:safe_load)
8
+ if Psych::VERSION >= "3.1"
9
+ YAML.unsafe_load(content) # instead of YAML.safe_load(content, permitted_classes: [Symbol])
10
+ else
11
+ YAML.unsafe_load(content) # instead of YAML.safe_load(content, [Symbol])
12
+ end
13
+ else
14
+ YAML.load(content)
15
+ end
16
+ if table == false || table == nil
17
+ {}
18
+ else
19
+ table
20
+ end
21
+ end
22
+ end
23
+
24
+ class YAML::Store
25
+ prepend YamlStoreUnsafeLoad
26
+ end if defined?(YAML::Store)
@@ -0,0 +1,4 @@
1
+ module YamlStoreUnsafeLoad
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yaml_store_unsafe_load
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - s3fxn
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2025-01-12 00:00:00.000000000 Z
11
+ dependencies: []
12
+ email:
13
+ - sssfxn@gmail.com
14
+ executables: []
15
+ extensions: []
16
+ extra_rdoc_files: []
17
+ files:
18
+ - README.md
19
+ - Rakefile
20
+ - lib/yaml_store_unsafe_load.rb
21
+ - lib/yaml_store_unsafe_load/version.rb
22
+ - sig/yaml_store_unsafe_load.rbs
23
+ homepage: https://github.com/s3fxn/yaml_store_unsafe_load
24
+ licenses: []
25
+ metadata:
26
+ allowed_push_host: https://rubygems.org
27
+ homepage_uri: https://github.com/s3fxn/yaml_store_unsafe_load
28
+ source_code_uri: https://github.com/s3fxn/yaml_store_unsafe_load
29
+ changelog_uri: https://github.com/s3fxn/yaml_store_unsafe_load
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: 3.3.0
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubygems_version: 3.6.2
45
+ specification_version: 4
46
+ summary: yaml_store_unsafe_load - patch to use unsafe_load instead of safe_load in
47
+ yaml/store
48
+ test_files: []