dslh 0.3.7 → 0.3.8
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/lib/dslh.rb +4 -2
- data/lib/dslh/version.rb +1 -1
- data/spec/dslh_spec.rb +49 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7267513e3fe1badab65d769c081bb53f2404de4d
|
4
|
+
data.tar.gz: 63b83baed10b9303f5078ab2d6b63231d85dc602
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47010ec35a9c6c7e963569a3ecd6605d44c803efcd0911a65a142fe4d58d33c10a308972830d840498d919fcfd6289e1dc375361f63b3060d0fb02518ed4bfc7
|
7
|
+
data.tar.gz: c7dd1ad51654a185a51b2722e583ca261866d95c22d5a5048ebc16f7c8953275ade78eca8384e7f0c9ced5d27ce2bff7f57386b46abaa72a5338ed7b0c5e6539
|
data/lib/dslh.rb
CHANGED
@@ -134,7 +134,7 @@ class Dslh
|
|
134
134
|
|
135
135
|
case value
|
136
136
|
when Hash
|
137
|
-
if exclude_keys?(value.keys)
|
137
|
+
if exclude_keys?(value.keys)
|
138
138
|
value_buf.puts('(' + ("\n" + value.pretty_inspect.strip).gsub("\n", "\n" + next_indent) + ')')
|
139
139
|
else
|
140
140
|
nested = true
|
@@ -143,7 +143,9 @@ class Dslh
|
|
143
143
|
value_buf.puts(indent + (@options[:use_braces_instead_of_do_end] ? '}' : 'end'))
|
144
144
|
end
|
145
145
|
when Array
|
146
|
-
if value.
|
146
|
+
if value.empty?
|
147
|
+
value_buf.puts(" []")
|
148
|
+
elsif value.any? {|v| [Array, Hash].any? {|c| v.kind_of?(c) }}
|
147
149
|
nested = true
|
148
150
|
|
149
151
|
if not @options[:dump_old_hash_array_format] and value.all? {|i| i.kind_of?(Hash) and not exclude_keys?(i.keys) }
|
data/lib/dslh/version.rb
CHANGED
data/spec/dslh_spec.rb
CHANGED
@@ -2434,6 +2434,51 @@ end
|
|
2434
2434
|
EOS
|
2435
2435
|
end
|
2436
2436
|
|
2437
|
+
it 'deval to hash from dsl that include empty array argument' do
|
2438
|
+
dsl = <<-EOS
|
2439
|
+
glossary do
|
2440
|
+
title "example glossary"
|
2441
|
+
GlossDiv do
|
2442
|
+
title "S"
|
2443
|
+
GlossList do
|
2444
|
+
GlossEntry do
|
2445
|
+
ID "SGML"
|
2446
|
+
SortAs "SGML"
|
2447
|
+
GlossTerm "Standard Generalized Markup Language"
|
2448
|
+
Acronym "SGML"
|
2449
|
+
Abbrev "ISO 8879:1986"
|
2450
|
+
GlossDef do
|
2451
|
+
para "A meta-markup language, used to create markup languages such as DocBook."
|
2452
|
+
GlossSeeAlso []
|
2453
|
+
end
|
2454
|
+
GlossSee "markup"
|
2455
|
+
end
|
2456
|
+
end
|
2457
|
+
end
|
2458
|
+
end
|
2459
|
+
EOS
|
2460
|
+
|
2461
|
+
h = Dslh.eval(dsl)
|
2462
|
+
expect(h).to eq(
|
2463
|
+
{"glossary"=>
|
2464
|
+
{"title"=>"example glossary",
|
2465
|
+
"GlossDiv"=>
|
2466
|
+
{"title"=>"S",
|
2467
|
+
"GlossList"=>
|
2468
|
+
{"GlossEntry"=>
|
2469
|
+
{"ID"=>"SGML",
|
2470
|
+
"SortAs"=>"SGML",
|
2471
|
+
"GlossTerm"=>"Standard Generalized Markup Language",
|
2472
|
+
"Acronym"=>"SGML",
|
2473
|
+
"Abbrev"=>"ISO 8879:1986",
|
2474
|
+
"GlossDef"=>
|
2475
|
+
{"para"=>
|
2476
|
+
"A meta-markup language, used to create markup languages such as DocBook.",
|
2477
|
+
"GlossSeeAlso"=>[]},
|
2478
|
+
"GlossSee"=>"markup"}}}}}
|
2479
|
+
)
|
2480
|
+
end
|
2481
|
+
|
2437
2482
|
it 'should be hash that include empty array' do
|
2438
2483
|
h = {"glossary"=>
|
2439
2484
|
{"title"=>"example glossary",
|
@@ -2465,10 +2510,10 @@ glossary do
|
|
2465
2510
|
GlossTerm "Standard Generalized Markup Language"
|
2466
2511
|
Acronym "SGML"
|
2467
2512
|
Abbrev "ISO 8879:1986"
|
2468
|
-
GlossDef
|
2469
|
-
|
2470
|
-
|
2471
|
-
|
2513
|
+
GlossDef do
|
2514
|
+
para "A meta-markup language, used to create markup languages such as DocBook."
|
2515
|
+
GlossSeeAlso []
|
2516
|
+
end
|
2472
2517
|
GlossSee "markup"
|
2473
2518
|
end
|
2474
2519
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dslh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|