dslh 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb022da4335f23ff59901ac5652400831dd13c6f
4
- data.tar.gz: 1e257ec574e65f1d24409001864aed67be2c8d84
3
+ metadata.gz: 630bd38fc0b9b3ea7888b3848ee2d4d624096c1e
4
+ data.tar.gz: c8ad565a5705c9a5bdf74eb7748139cb4e651198
5
5
  SHA512:
6
- metadata.gz: 90d4d8d730e57bab79f1e438996f6d0e1de4d7c5a5701b0affb0bb9da9ecc056633426d8c204d48f00ea7029ac2ee725c42673761161a6fc5493f558658aee57
7
- data.tar.gz: 78e73bcd8b3686b8dbfc6d8dff8a0e9d56a0f53d77730d991fef01270bde4b0ac5a7ed0a5c432d631e3115b2d8df1fb1f50dac79ff689d3c13a158c8ca08ac4a
6
+ metadata.gz: 3816de53acef37f05ce31531d6238494fb7d12d5672b7eebda49f03914d08f132a2aec6bad558b4868790e2f247c9144142e49ff442f3bfa4731722f62fb10a6
7
+ data.tar.gz: a71302974f181b5560d94d1787cb38b230aebaf1d30d0733259c2ad203e4fe631509780adc739240863ca7f29b129f93eadc832621f8518f3d3a40abf83dbf72
@@ -82,7 +82,8 @@ class Dslh
82
82
 
83
83
  def deval(hash)
84
84
  buf = StringIO.new
85
- deval0(hash, 0, buf)
85
+ depth = @options[:initial_depth] || 0
86
+ deval0(hash, depth, buf)
86
87
  buf.string
87
88
  end
88
89
 
@@ -1,3 +1,3 @@
1
1
  class Dslh
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
3
3
  end
@@ -2633,4 +2633,47 @@ glossary do
2633
2633
  end
2634
2634
  EOS
2635
2635
  end
2636
+
2637
+ it 'should convert hash to dsl (initial_depth: 1)' do
2638
+ h = {:glossary=>
2639
+ {:title=>"example glossary",
2640
+ :GlossDiv=>
2641
+ {:title=>"S",
2642
+ :GlossList=>
2643
+ {:GlossEntry=>
2644
+ {:ID=>"SGML",
2645
+ :SortAs=>"SGML",
2646
+ :GlossTerm=>"Standard Generalized Markup Language",
2647
+ :Acronym=>"SGML",
2648
+ :Abbrev=>"ISO 8879:1986",
2649
+ :GlossDef=>
2650
+ {:para=>
2651
+ "A meta-markup language, used to create markup languages such as DocBook.",
2652
+ :GlossSeeAlso=>["GML", "XML"]},
2653
+ :GlossSee=>"markup"}}}}}
2654
+
2655
+ dsl = Dslh.deval(h, :initial_depth => 1)
2656
+ expect(dsl).to eq(<<-EOS)
2657
+ glossary do
2658
+ title "example glossary"
2659
+ GlossDiv do
2660
+ title "S"
2661
+ GlossList do
2662
+ GlossEntry do
2663
+ ID "SGML"
2664
+ SortAs "SGML"
2665
+ GlossTerm "Standard Generalized Markup Language"
2666
+ Acronym "SGML"
2667
+ Abbrev "ISO 8879:1986"
2668
+ GlossDef do
2669
+ para "A meta-markup language, used to create markup languages such as DocBook."
2670
+ GlossSeeAlso "GML", "XML"
2671
+ end
2672
+ GlossSee "markup"
2673
+ end
2674
+ end
2675
+ end
2676
+ end
2677
+ EOS
2678
+ end
2636
2679
  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.2
4
+ version: 0.3.3
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-21 00:00:00.000000000 Z
11
+ date: 2016-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler