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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55eec0639be0db3bb497f07d9817d59eea9bad16
4
- data.tar.gz: 4218cd7efaf2811322ab9507263d7c6d58ab161b
3
+ metadata.gz: 7f4139a986ed8d81eb503ec5bd8400d8f7d9817d
4
+ data.tar.gz: dcc5a8d2be12e3cf8cd97dcff519f804bc7ceef2
5
5
  SHA512:
6
- metadata.gz: d5792a620a12baee32d8800356505243e356e8073eb43958dc338ade24ea66429bbf109b11fe4e31b1dbc12ba941d29e67e1711a9630f1c75af06bbda25ea883
7
- data.tar.gz: b8bea7351a8a13e8f2964c75148cb378d86b57dcf04e854b51cfc90231cdcfcc0d35b466ed01a8697d7f050709d7501263b1def90e6760152eca1cb3518f62cd
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
- Not available nest array and hash.
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, '"')
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module YamlCreator
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -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.0
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-10-29 00:00:00.000000000 Z
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: []