jyaml 0.0.1

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/yaml2json.rb +12 -0
  3. metadata +38 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 948fea80cf6875f47fb322dd06a987791539f3f04a2a9e702cdfc618bd031eed
4
+ data.tar.gz: cc2d302a2c08012b4b6b12e1d7f1a70e68d80301736a175d4b73e42be865ca4e
5
+ SHA512:
6
+ metadata.gz: 1ff252ff305bc0a9d75a8df36fb3b1483d0d26cecbe0de19c126c53db8eda83b04edcc10aa89ed8a20bb2798a56ce558fbecea3b3294d2993ae2f80397964fcc
7
+ data.tar.gz: b94e07f0c1fa1176a18168b7f343affd28f058f6e2f3037b59e3b0ca64bb5b2f7fab26937a932389bb72139a9c4ec19f439c704ed83c30ff9862028fe1d0c99f
data/lib/yaml2json.rb ADDED
@@ -0,0 +1,12 @@
1
+ require 'yaml'
2
+ require 'json'
3
+
4
+ # convert yaml to json
5
+ def convert_yaml_to_json(yaml_file, json_file, encoding)
6
+ configs = YAML.load_file(yaml_file)
7
+ content = JSON.generate(configs).class
8
+
9
+ File.open(json_file, 'w', encoding: encoding) {
10
+ |f| f.puts JSON.generate(configs)
11
+ }
12
+ end
metadata ADDED
@@ -0,0 +1,38 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jyaml
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sicheng Zhong
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ email: zhong_sicheng@outlook.com
13
+ executables: []
14
+ extensions: []
15
+ extra_rdoc_files: []
16
+ files:
17
+ - lib/yaml2json.rb
18
+ licenses:
19
+ - GPL-3.0-or-later
20
+ metadata: {}
21
+ rdoc_options: []
22
+ require_paths:
23
+ - lib
24
+ required_ruby_version: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: 3.1.0
29
+ required_rubygems_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ requirements: []
35
+ rubygems_version: 4.0.20
36
+ specification_version: 4
37
+ summary: Convery YAML to JSON
38
+ test_files: []