yaml_creator 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/lib/yaml_creator.rb +13 -0
- data/lib/yaml_creator/parser.rb +13 -0
- data/lib/yaml_creator/version.rb +1 -1
- data/yaml_creator.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f4139a986ed8d81eb503ec5bd8400d8f7d9817d
|
|
4
|
+
data.tar.gz: dcc5a8d2be12e3cf8cd97dcff519f804bc7ceef2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ffcbd874f1dc9c7ad11174a2aea453984bc3e6cd9b02fd0512b7291f36f4ef8bae49f0896b1a96acf3814694376964f113c00a6668a02404af2257dc5bfe99ff
|
|
7
|
+
data.tar.gz: f62f710b9fc6ddf876c4486e8b454b78d37cb681294ac5fd75292c58018b9b7922f176bf53755b7fe6fa05ba6487f49bd44793857b096a43c637819fdd994731
|
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/yaml_creator`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
4
|
|
|
5
5
|
Create yaml file from simple array and hash.
|
|
6
|
-
|
|
6
|
+
This gem not use yaml lib.
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
@@ -30,6 +30,13 @@ YamlCreator.from_array('your filepath', array, '"')
|
|
|
30
30
|
# without enclosure.
|
|
31
31
|
YamlCreator.from_array('your filepath', array)
|
|
32
32
|
|
|
33
|
+
# YAML file from complex array(you can use nest)
|
|
34
|
+
# array is made flatter and is made as yaml.
|
|
35
|
+
# with enclosure, complex array.
|
|
36
|
+
YamlCreator.from_complex_array('your filepath', array, '"')
|
|
37
|
+
# without enclosure, complex array.
|
|
38
|
+
YamlCreator.from_complex_array('your filepath', array)
|
|
39
|
+
|
|
33
40
|
# YAML file from hash
|
|
34
41
|
# with enclosure.
|
|
35
42
|
YamlCreator.from_hash('your filepath', hash, '"')
|
data/lib/yaml_creator.rb
CHANGED
|
@@ -16,6 +16,19 @@ module YamlCreator
|
|
|
16
16
|
save_file(filepath, yaml_array)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
# create yaml file from array(allow nest).
|
|
20
|
+
# array is made flatter and is made as yaml.
|
|
21
|
+
# @param [String] filepath save yaml file path
|
|
22
|
+
# @param [Array] array target array
|
|
23
|
+
# @param [String] enclosure enclosure character
|
|
24
|
+
def self.from_complex_array(filepath, array, enclosure="")
|
|
25
|
+
|
|
26
|
+
# create yaml array.
|
|
27
|
+
yaml_array = YamlCreator::Parser.from_complex_array(array, enclosure)
|
|
28
|
+
# save file.
|
|
29
|
+
save_file(filepath, yaml_array)
|
|
30
|
+
end
|
|
31
|
+
|
|
19
32
|
# create yaml file from hash(not nest).
|
|
20
33
|
# @param [String] filepath save yaml file path
|
|
21
34
|
# @param [Hash] hash target hash
|
data/lib/yaml_creator/parser.rb
CHANGED
|
@@ -16,6 +16,19 @@ module YamlCreator
|
|
|
16
16
|
}
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
# parse yaml from array.
|
|
20
|
+
# array is made flatter and is made as yaml.
|
|
21
|
+
# @param [Array] array target array
|
|
22
|
+
# @param [String] enclosure enclosure character
|
|
23
|
+
# @return [Array] yaml array
|
|
24
|
+
def self.from_complex_array(array, enclosure="")
|
|
25
|
+
|
|
26
|
+
# flatten array.
|
|
27
|
+
flatten_array = array.flatten
|
|
28
|
+
# create yaml array.
|
|
29
|
+
from_array(flatten_array, enclosure)
|
|
30
|
+
end
|
|
31
|
+
|
|
19
32
|
# parse yaml from hash.
|
|
20
33
|
# @param [Hash] hash yaml hash
|
|
21
34
|
# @param [String] enclosure enclosure character
|
data/lib/yaml_creator/version.rb
CHANGED
data/yaml_creator.gemspec
CHANGED
|
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
|
9
9
|
spec.authors = ["h.shigemoto"]
|
|
10
10
|
spec.email = ["corporation.ore@gmail.com"]
|
|
11
11
|
|
|
12
|
-
spec.summary = %q{Create yaml file from array and hash.}
|
|
13
|
-
spec.description = %q{Create yaml file from array and hash.}
|
|
12
|
+
spec.summary = %q{Create yaml file from array and hash. This gem not use yaml lib.}
|
|
13
|
+
spec.description = %q{Create yaml file from array and hash. This gem not use yaml lib.}
|
|
14
14
|
spec.homepage = "https://github.com/koyupi/yaml_creator"
|
|
15
15
|
spec.license = "MIT"
|
|
16
16
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yaml_creator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- h.shigemoto
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -52,7 +52,7 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '3.0'
|
|
55
|
-
description: Create yaml file from array and hash.
|
|
55
|
+
description: Create yaml file from array and hash. This gem not use yaml lib.
|
|
56
56
|
email:
|
|
57
57
|
- corporation.ore@gmail.com
|
|
58
58
|
executables: []
|
|
@@ -96,5 +96,5 @@ rubyforge_project:
|
|
|
96
96
|
rubygems_version: 2.6.6
|
|
97
97
|
signing_key:
|
|
98
98
|
specification_version: 4
|
|
99
|
-
summary: Create yaml file from array and hash.
|
|
99
|
+
summary: Create yaml file from array and hash. This gem not use yaml lib.
|
|
100
100
|
test_files: []
|