to_simple_yaml 1.0.3 → 1.0.4

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: '08afbaadd7cb4b24e8b7d7ee7a195ea8c5f0d921a234cc9ce8c4661994f6219d'
4
- data.tar.gz: 0a701b137593a38f266622565f399d679d7d2c28b2d6355802e44ae8caa4ab16
3
+ metadata.gz: 70c7c3e7f07b2f8698e21784e8e37e2fb31a090dd847f3b93ea4e49742778c0a
4
+ data.tar.gz: 21ccb29d96df8261713cfff74fa09e99c6415df1956bd4cbb49dd8f1df1b98f1
5
5
  SHA512:
6
- metadata.gz: b6732abd96cbe16e7b94d943744c6ac3f3d6979fb3f74f0db0e4188e195d3dfb006f18e025c9061e4d9685fc3c46705dfada831deac58ac232c39f091ceb4ea1
7
- data.tar.gz: d713c143dd95a321ed75a5a264e7aff7c39f958a849ef4f0007c97ff47be488be4a9dbd9a45452d3bdd86b4034ce48efd27ca2c34486e14d2ce56a677a88f3b9
6
+ metadata.gz: b3314841f5bd13c319008d376172c2c7980e1f138b3a3499c48495bbf5590d754b0fa91771362b1d724c9d64aba24717c33b9511b5338633ab8b1928df360f42
7
+ data.tar.gz: f3010ee3b67a1c28df89b71b6057963884f0839f312435289519633bf520f14f5b8d7c1a5a7fdbb2240c38e13197c5cb6954a0a17bf28097525a9808d37fafbb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- to_simple_yaml (1.0.3)
4
+ to_simple_yaml (1.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -25,7 +25,9 @@ class Object
25
25
  obj.compact.keys.each_with_index do |key, index|
26
26
  array_first = array && index == 0
27
27
  array_inline = array && index != 0
28
- if obj[key].is_a?(String) || obj[key].is_a?(Numeric) || obj[key].is_a?(TrueClass) || obj[key].is_a?(FalseClass)
28
+ if obj[key].is_a?(String) && obj[key].start_with?('#')
29
+ yaml << template("#{array_first ? '- ' : ''}#{key}: '#{obj[key]}'", array_inline ? indent + 1 : indent)
30
+ elsif obj[key].is_a?(String) || obj[key].is_a?(Numeric) || obj[key].is_a?(TrueClass) || obj[key].is_a?(FalseClass)
29
31
  yaml << template("#{array_first ? '- ' : ''}#{key}: #{obj[key]}", array_inline ? indent + 1 : indent)
30
32
  elsif obj[key].is_a?(Symbol)
31
33
  yaml << template("#{array_first ? '- ' : ''}#{key}: #{obj[key].to_s}", array_inline ? indent + 1 : indent)
@@ -41,7 +43,9 @@ class Object
41
43
  elsif obj.is_a?(Array)
42
44
  yaml = ''
43
45
  obj.compact.each do |value|
44
- if value.is_a?(String) || value.is_a?(Numeric) || value.is_a?(TrueClass) || value.is_a?(FalseClass)
46
+ if value.is_a?(String) && value.start_with?('#')
47
+ yaml << template("- '#{value}'", indent)
48
+ elsif value.is_a?(String) || value.is_a?(Numeric) || value.is_a?(TrueClass) || value.is_a?(FalseClass)
45
49
  yaml << template("- #{value}", indent)
46
50
  elsif value.is_a?(Symbol)
47
51
  yaml << template("- #{value.to_s}", indent)
@@ -1,3 +1,3 @@
1
1
  module ToSimpleYaml
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_simple_yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - tanmen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-11 00:00:00.000000000 Z
11
+ date: 2019-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler