dslh 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dslh.rb +54 -27
  3. data/lib/dslh/version.rb +1 -1
  4. data/spec/dslh_spec.rb +223 -191
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 630bd38fc0b9b3ea7888b3848ee2d4d624096c1e
4
- data.tar.gz: c8ad565a5705c9a5bdf74eb7748139cb4e651198
3
+ metadata.gz: 23606816e11bb7d500a3d596f1d7a9d0402e7019
4
+ data.tar.gz: dc4b77c1763562bfc9fe2f7cab15881b93239d11
5
5
  SHA512:
6
- metadata.gz: 3816de53acef37f05ce31531d6238494fb7d12d5672b7eebda49f03914d08f132a2aec6bad558b4868790e2f247c9144142e49ff442f3bfa4731722f62fb10a6
7
- data.tar.gz: a71302974f181b5560d94d1787cb38b230aebaf1d30d0733259c2ad203e4fe631509780adc739240863ca7f29b129f93eadc832621f8518f3d3a40abf83dbf72
6
+ metadata.gz: 18595e8bc2cd2cb93ebb1905957010af282ad3405e216972b1861317c341ee02599c3799725a83702213a5927c548bdcb15035da31308e39b0b4c9e4831e9697
7
+ data.tar.gz: 1e012c9cbb59d168111f362104af69656c1d0b8b57e58bde707eb338a928bcd40c6a45893a2c15891b14c8eed9a42339de27667a0b404c48e9870343c8fc4c46
data/lib/dslh.rb CHANGED
@@ -39,7 +39,8 @@ class Dslh
39
39
 
40
40
  def initialize(options = {})
41
41
  @options = {
42
- :time_inspecter => method(:inspect_time)
42
+ :time_inspecter => method(:inspect_time),
43
+ :dump_old_hash_array_format => false,
43
44
  }.merge(options)
44
45
 
45
46
  @options[:key_conv] ||= (@options[:conv] || proc {|i| i.to_s })
@@ -118,12 +119,12 @@ class Dslh
118
119
  buf.puts(indent + key_value)
119
120
  else
120
121
  buf.print(indent + key)
121
- value_proc(value, depth, buf)
122
+ value_proc(value, depth, buf, true, key)
122
123
  end
123
124
  end
124
125
  end
125
126
 
126
- def value_proc(value, depth, value_buf, newline = true)
127
+ def value_proc(value, depth, value_buf, newline = true, curr_key = nil)
127
128
  indent = (INDENT_SPACES * depth)
128
129
  next_indent = (INDENT_SPACES * (depth + 1))
129
130
  value_conv = @options[:value_conv]
@@ -142,28 +143,47 @@ class Dslh
142
143
  when Array
143
144
  if value.any? {|v| [Array, Hash].any? {|c| v.kind_of?(c) }}
144
145
  nested = true
145
- value_buf.puts(' [')
146
-
147
- value.each_with_index do |v, i|
148
- case v
149
- when Hash
150
- value_buf.puts(next_indent + '_{')
151
- deval0(v, depth + 2, value_buf)
152
- value_buf.print(next_indent + '}')
153
- when Array
154
- value_buf.print(next_indent.slice(0...-1))
155
- value_proc(v, depth + 1, value_buf, false)
146
+
147
+ if not @options[:dump_old_hash_array_format] and value.all? {|i| i.kind_of?(Hash) }
148
+ value_buf.puts(' do |*|')
149
+
150
+ value.each_with_index do |v, i|
151
+ deval0(v, depth + 1, value_buf)
152
+
153
+ if i < (value.length - 1)
154
+ value_buf.puts(indent + "end\n" + indent + curr_key + ' do |*|')
155
+ end
156
+ end
157
+
158
+ if newline
159
+ value_buf.puts(indent + 'end')
156
160
  else
157
- value_buf.print(next_indent + v.pretty_inspect.strip.gsub("\n", "\n" + next_indent))
161
+ value_buf.print(indent + 'end')
158
162
  end
163
+ else
164
+ value_buf.puts(' [')
165
+
166
+ value.each_with_index do |v, i|
167
+ case v
168
+ when Hash
169
+ value_buf.puts(next_indent + '_{')
170
+ deval0(v, depth + 2, value_buf)
171
+ value_buf.print(next_indent + '}')
172
+ when Array
173
+ value_buf.print(next_indent.slice(0...-1))
174
+ value_proc(v, depth + 1, value_buf, false)
175
+ else
176
+ value_buf.print(next_indent + v.pretty_inspect.strip.gsub("\n", "\n" + next_indent))
177
+ end
159
178
 
160
- value_buf.puts(i < (value.length - 1) ? ',' : '')
161
- end
179
+ value_buf.puts(i < (value.length - 1) ? ',' : '')
180
+ end
162
181
 
163
- if newline
164
- value_buf.puts(indent + ']')
165
- else
166
- value_buf.print(indent + ']')
182
+ if newline
183
+ value_buf.puts(indent + ']')
184
+ else
185
+ value_buf.print(indent + ']')
186
+ end
167
187
  end
168
188
  elsif value.length == 1
169
189
  value_buf.puts(' ' + value.inspect)
@@ -239,22 +259,29 @@ class Dslh
239
259
  nested_hash = block ? ScopeBlock.nest(binding, 'block', method_name) : nil
240
260
  method_name = key_conv.call(method_name) if key_conv
241
261
 
242
- if not @__options__[:allow_duplicate] and @__hash__.has_key?(method_name)
262
+ if not @__options__[:allow_duplicate] and @__hash__.has_key?(method_name) and not (block and block.arity == -1)
243
263
  raise "duplicate key #{method_name.inspect}"
244
264
  end
245
265
 
266
+ push_to_hash = proc do |v|
267
+ if block and block.arity == -1
268
+ @__hash__[method_name] ||= []
269
+ @__hash__[method_name] << v
270
+ else
271
+ @__hash__[method_name] = v
272
+ end
273
+ end
274
+
246
275
  if args.empty?
247
- @__hash__[method_name] = nested_hash
276
+ push_to_hash.call(nested_hash)
248
277
  else
249
278
  args = args.map {|i| value_conv.call(i) } if value_conv
250
279
  value = args.length > 1 ? args : args[0]
251
280
 
252
281
  if nested_hash
253
- @__hash__[method_name] = {
254
- value => nested_hash
255
- }
282
+ push_to_hash.call(value => nested_hash)
256
283
  else
257
- @__hash__[method_name] = value
284
+ push_to_hash.call(value)
258
285
  end
259
286
 
260
287
  return @__hash__
data/lib/dslh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Dslh
2
- VERSION = '0.3.3'
2
+ VERSION = '0.3.4'
3
3
  end
data/spec/dslh_spec.rb CHANGED
@@ -767,6 +767,14 @@ end
767
767
  expect(evaluated).to eq(template)
768
768
  end
769
769
 
770
+ it 'should convert json to dsl (old format)' do
771
+ template = JSON.parse(drupal_multi_az_template)
772
+
773
+ dsl = Dslh.deval(template)
774
+ evaluated = Dslh.eval(dsl, :key_conv => proc {|i| i.to_s }, :dump_old_hash_array_format => true)
775
+ expect(evaluated).to eq(template)
776
+ end
777
+
770
778
  it 'should convert json to dsl with key_conf' do
771
779
  template = JSON.parse(drupal_multi_az_template)
772
780
 
@@ -935,30 +943,28 @@ Resources do
935
943
  PolicyDocument do
936
944
  Version "2008-10-17"
937
945
  Id "UploadPolicy"
938
- Statement [
939
- _{
940
- Sid "EnableReadWrite"
941
- Action "s3:GetObject", "s3:PutObject", "s3:PutObjectACL"
942
- Effect "Allow"
943
- Resource do
944
- Fn__Join [
945
- "",
946
- [
947
- "arn:aws:s3:::",
948
- _{
949
- Ref "S3Bucket"
950
- },
951
- "/*"
952
- ]
946
+ Statement do |*|
947
+ Sid "EnableReadWrite"
948
+ Action "s3:GetObject", "s3:PutObject", "s3:PutObjectACL"
949
+ Effect "Allow"
950
+ Resource do
951
+ Fn__Join [
952
+ "",
953
+ [
954
+ "arn:aws:s3:::",
955
+ _{
956
+ Ref "S3Bucket"
957
+ },
958
+ "/*"
953
959
  ]
960
+ ]
961
+ end
962
+ Principal do
963
+ AWS do
964
+ Fn__GetAtt "S3User", "Arn"
954
965
  end
955
- Principal do
956
- AWS do
957
- Fn__GetAtt "S3User", "Arn"
958
- end
959
- end
960
- }
961
- ]
966
+ end
967
+ end
962
968
  end
963
969
  Bucket do
964
970
  Ref "S3Bucket"
@@ -969,20 +975,16 @@ Resources do
969
975
  Type "AWS::IAM::User"
970
976
  Properties do
971
977
  Path "/"
972
- Policies [
973
- _{
974
- PolicyName "root"
975
- PolicyDocument do
976
- Statement [
977
- _{
978
- Effect "Allow"
979
- Action "s3:*"
980
- Resource "*"
981
- }
982
- ]
978
+ Policies do |*|
979
+ PolicyName "root"
980
+ PolicyDocument do
981
+ Statement do |*|
982
+ Effect "Allow"
983
+ Action "s3:*"
984
+ Resource "*"
983
985
  end
984
- }
985
- ]
986
+ end
987
+ end
986
988
  end
987
989
  end
988
990
  S3Keys do
@@ -1002,20 +1004,16 @@ Resources do
1002
1004
  AvailabilityZones do
1003
1005
  Fn__GetAZs ""
1004
1006
  end
1005
- LBCookieStickinessPolicy [
1006
- _{
1007
- PolicyName "CookieBasedPolicy"
1008
- CookieExpirationPeriod "30"
1009
- }
1010
- ]
1011
- Listeners [
1012
- _{
1013
- LoadBalancerPort "80"
1014
- InstancePort "80"
1015
- Protocol "HTTP"
1016
- PolicyNames ["CookieBasedPolicy"]
1017
- }
1018
- ]
1007
+ LBCookieStickinessPolicy do |*|
1008
+ PolicyName "CookieBasedPolicy"
1009
+ CookieExpirationPeriod "30"
1010
+ end
1011
+ Listeners do |*|
1012
+ LoadBalancerPort "80"
1013
+ InstancePort "80"
1014
+ Protocol "HTTP"
1015
+ PolicyNames ["CookieBasedPolicy"]
1016
+ end
1019
1017
  HealthCheck do
1020
1018
  Target "HTTP:80/"
1021
1019
  HealthyThreshold "2"
@@ -1039,11 +1037,9 @@ Resources do
1039
1037
  DesiredCapacity do
1040
1038
  Ref "WebServerCapacity"
1041
1039
  end
1042
- LoadBalancerNames [
1043
- _{
1044
- Ref "ElasticLoadBalancer"
1045
- }
1046
- ]
1040
+ LoadBalancerNames do |*|
1041
+ Ref "ElasticLoadBalancer"
1042
+ end
1047
1043
  end
1048
1044
  end
1049
1045
  LaunchConfig do
@@ -1166,11 +1162,9 @@ Resources do
1166
1162
  InstanceType do
1167
1163
  Ref "InstanceType"
1168
1164
  end
1169
- SecurityGroups [
1170
- _{
1171
- Ref "WebServerSecurityGroup"
1172
- }
1173
- ]
1165
+ SecurityGroups do |*|
1166
+ Ref "WebServerSecurityGroup"
1167
+ end
1174
1168
  KeyName do
1175
1169
  Ref "KeyName"
1176
1170
  end
@@ -1316,11 +1310,9 @@ Resources do
1316
1310
  DBInstanceClass do
1317
1311
  Ref "DBClass"
1318
1312
  end
1319
- DBSecurityGroups [
1320
- _{
1321
- Ref "DBSecurityGroup"
1322
- }
1323
- ]
1313
+ DBSecurityGroups do |*|
1314
+ Ref "DBSecurityGroup"
1315
+ end
1324
1316
  AllocatedStorage do
1325
1317
  Ref "DBAllocatedStorage"
1326
1318
  end
@@ -1344,27 +1336,25 @@ Resources do
1344
1336
  Type "AWS::EC2::SecurityGroup"
1345
1337
  Properties do
1346
1338
  GroupDescription "Enable HTTP access via port 80, locked down to requests from the load balancer only and SSH access"
1347
- SecurityGroupIngress [
1348
- _{
1349
- IpProtocol "tcp"
1350
- FromPort "80"
1351
- ToPort "80"
1352
- SourceSecurityGroupOwnerId do
1353
- Fn__GetAtt "ElasticLoadBalancer", "SourceSecurityGroup.OwnerAlias"
1354
- end
1355
- SourceSecurityGroupName do
1356
- Fn__GetAtt "ElasticLoadBalancer", "SourceSecurityGroup.GroupName"
1357
- end
1358
- },
1359
- _{
1360
- IpProtocol "tcp"
1361
- FromPort "22"
1362
- ToPort "22"
1363
- CidrIp do
1364
- Ref "SSHLocation"
1365
- end
1366
- }
1367
- ]
1339
+ SecurityGroupIngress do |*|
1340
+ IpProtocol "tcp"
1341
+ FromPort "80"
1342
+ ToPort "80"
1343
+ SourceSecurityGroupOwnerId do
1344
+ Fn__GetAtt "ElasticLoadBalancer", "SourceSecurityGroup.OwnerAlias"
1345
+ end
1346
+ SourceSecurityGroupName do
1347
+ Fn__GetAtt "ElasticLoadBalancer", "SourceSecurityGroup.GroupName"
1348
+ end
1349
+ end
1350
+ SecurityGroupIngress do |*|
1351
+ IpProtocol "tcp"
1352
+ FromPort "22"
1353
+ ToPort "22"
1354
+ CidrIp do
1355
+ Ref "SSHLocation"
1356
+ end
1357
+ end
1368
1358
  end
1369
1359
  end
1370
1360
  end
@@ -1572,30 +1562,28 @@ Resources do
1572
1562
  PolicyDocument do
1573
1563
  Version "2008-10-17"
1574
1564
  Id "UploadPolicy"
1575
- Statement [
1576
- _{
1577
- Sid "EnableReadWrite"
1578
- Action "s3:GetObject", "s3:PutObject", "s3:PutObjectACL"
1579
- Effect "Allow"
1580
- Resource do
1581
- Fn__Join [
1582
- "",
1583
- [
1584
- "arn:aws:s3:::",
1585
- _{
1586
- Ref "S3Bucket"
1587
- },
1588
- "/*"
1589
- ]
1565
+ Statement do |*|
1566
+ Sid "EnableReadWrite"
1567
+ Action "s3:GetObject", "s3:PutObject", "s3:PutObjectACL"
1568
+ Effect "Allow"
1569
+ Resource do
1570
+ Fn__Join [
1571
+ "",
1572
+ [
1573
+ "arn:aws:s3:::",
1574
+ _{
1575
+ Ref "S3Bucket"
1576
+ },
1577
+ "/*"
1590
1578
  ]
1579
+ ]
1580
+ end
1581
+ Principal do
1582
+ AWS do
1583
+ Fn__GetAtt "S3User", "Arn"
1591
1584
  end
1592
- Principal do
1593
- AWS do
1594
- Fn__GetAtt "S3User", "Arn"
1595
- end
1596
- end
1597
- }
1598
- ]
1585
+ end
1586
+ end
1599
1587
  end
1600
1588
  Bucket do
1601
1589
  Ref "S3Bucket"
@@ -1606,20 +1594,16 @@ Resources do
1606
1594
  Type "AWS::IAM::User"
1607
1595
  Properties do
1608
1596
  Path "/"
1609
- Policies [
1610
- _{
1611
- PolicyName "root"
1612
- PolicyDocument do
1613
- Statement [
1614
- _{
1615
- Effect "Allow"
1616
- Action "s3:*"
1617
- Resource "*"
1618
- }
1619
- ]
1597
+ Policies do |*|
1598
+ PolicyName "root"
1599
+ PolicyDocument do
1600
+ Statement do |*|
1601
+ Effect "Allow"
1602
+ Action "s3:*"
1603
+ Resource "*"
1620
1604
  end
1621
- }
1622
- ]
1605
+ end
1606
+ end
1623
1607
  end
1624
1608
  end
1625
1609
  S3Keys do
@@ -1639,20 +1623,16 @@ Resources do
1639
1623
  AvailabilityZones do
1640
1624
  Fn__GetAZs ""
1641
1625
  end
1642
- LBCookieStickinessPolicy [
1643
- _{
1644
- PolicyName "CookieBasedPolicy"
1645
- CookieExpirationPeriod "30"
1646
- }
1647
- ]
1648
- Listeners [
1649
- _{
1650
- LoadBalancerPort "80"
1651
- InstancePort "80"
1652
- Protocol "HTTP"
1653
- PolicyNames ["CookieBasedPolicy"]
1654
- }
1655
- ]
1626
+ LBCookieStickinessPolicy do |*|
1627
+ PolicyName "CookieBasedPolicy"
1628
+ CookieExpirationPeriod "30"
1629
+ end
1630
+ Listeners do |*|
1631
+ LoadBalancerPort "80"
1632
+ InstancePort "80"
1633
+ Protocol "HTTP"
1634
+ PolicyNames ["CookieBasedPolicy"]
1635
+ end
1656
1636
  HealthCheck do
1657
1637
  Target "HTTP:80/"
1658
1638
  HealthyThreshold "2"
@@ -1676,11 +1656,9 @@ Resources do
1676
1656
  DesiredCapacity do
1677
1657
  Ref "WebServerCapacity"
1678
1658
  end
1679
- LoadBalancerNames [
1680
- _{
1681
- Ref "ElasticLoadBalancer"
1682
- }
1683
- ]
1659
+ LoadBalancerNames do |*|
1660
+ Ref "ElasticLoadBalancer"
1661
+ end
1684
1662
  end
1685
1663
  end
1686
1664
  LaunchConfig do
@@ -1829,11 +1807,9 @@ Resources do
1829
1807
  InstanceType do
1830
1808
  Ref "InstanceType"
1831
1809
  end
1832
- SecurityGroups [
1833
- _{
1834
- Ref "WebServerSecurityGroup"
1835
- }
1836
- ]
1810
+ SecurityGroups do |*|
1811
+ Ref "WebServerSecurityGroup"
1812
+ end
1837
1813
  KeyName do
1838
1814
  Ref "KeyName"
1839
1815
  end
@@ -1979,11 +1955,9 @@ Resources do
1979
1955
  DBInstanceClass do
1980
1956
  Ref "DBClass"
1981
1957
  end
1982
- DBSecurityGroups [
1983
- _{
1984
- Ref "DBSecurityGroup"
1985
- }
1986
- ]
1958
+ DBSecurityGroups do |*|
1959
+ Ref "DBSecurityGroup"
1960
+ end
1987
1961
  AllocatedStorage do
1988
1962
  Ref "DBAllocatedStorage"
1989
1963
  end
@@ -2007,27 +1981,25 @@ Resources do
2007
1981
  Type "AWS::EC2::SecurityGroup"
2008
1982
  Properties do
2009
1983
  GroupDescription "Enable HTTP access via port 80, locked down to requests from the load balancer only and SSH access"
2010
- SecurityGroupIngress [
2011
- _{
2012
- IpProtocol "tcp"
2013
- FromPort "80"
2014
- ToPort "80"
2015
- SourceSecurityGroupOwnerId do
2016
- Fn__GetAtt "ElasticLoadBalancer", "SourceSecurityGroup.OwnerAlias"
2017
- end
2018
- SourceSecurityGroupName do
2019
- Fn__GetAtt "ElasticLoadBalancer", "SourceSecurityGroup.GroupName"
2020
- end
2021
- },
2022
- _{
2023
- IpProtocol "tcp"
2024
- FromPort "22"
2025
- ToPort "22"
2026
- CidrIp do
2027
- Ref "SSHLocation"
2028
- end
2029
- }
2030
- ]
1984
+ SecurityGroupIngress do |*|
1985
+ IpProtocol "tcp"
1986
+ FromPort "80"
1987
+ ToPort "80"
1988
+ SourceSecurityGroupOwnerId do
1989
+ Fn__GetAtt "ElasticLoadBalancer", "SourceSecurityGroup.OwnerAlias"
1990
+ end
1991
+ SourceSecurityGroupName do
1992
+ Fn__GetAtt "ElasticLoadBalancer", "SourceSecurityGroup.GroupName"
1993
+ end
1994
+ end
1995
+ SecurityGroupIngress do |*|
1996
+ IpProtocol "tcp"
1997
+ FromPort "22"
1998
+ ToPort "22"
1999
+ CidrIp do
2000
+ Ref "SSHLocation"
2001
+ end
2002
+ end
2031
2003
  end
2032
2004
  end
2033
2005
  end
@@ -2305,11 +2277,9 @@ Resources do
2305
2277
  InstanceType do
2306
2278
  Ref "InstanceType"
2307
2279
  end
2308
- SecurityGroups [
2309
- _{
2310
- Ref "WebServerSecurityGroup"
2311
- }
2312
- ]
2280
+ SecurityGroups do |*|
2281
+ Ref "WebServerSecurityGroup"
2282
+ end
2313
2283
  KeyName do
2314
2284
  Ref "KeyName"
2315
2285
  end
@@ -2420,22 +2390,20 @@ Resources do
2420
2390
  Type "AWS::EC2::SecurityGroup"
2421
2391
  Properties do
2422
2392
  GroupDescription "Enable HTTP access via port 80 and SSH access"
2423
- SecurityGroupIngress [
2424
- _{
2425
- IpProtocol "tcp"
2426
- FromPort "80"
2427
- ToPort "80"
2428
- CidrIp "0.0.0.0/0"
2429
- },
2430
- _{
2431
- IpProtocol "tcp"
2432
- FromPort "22"
2433
- ToPort "22"
2434
- CidrIp do
2435
- Ref "SSHLocation"
2436
- end
2437
- }
2438
- ]
2393
+ SecurityGroupIngress do |*|
2394
+ IpProtocol "tcp"
2395
+ FromPort "80"
2396
+ ToPort "80"
2397
+ CidrIp "0.0.0.0/0"
2398
+ end
2399
+ SecurityGroupIngress do |*|
2400
+ IpProtocol "tcp"
2401
+ FromPort "22"
2402
+ ToPort "22"
2403
+ CidrIp do
2404
+ Ref "SSHLocation"
2405
+ end
2406
+ end
2439
2407
  end
2440
2408
  end
2441
2409
  end
@@ -2676,4 +2644,68 @@ end
2676
2644
  end
2677
2645
  EOS
2678
2646
  end
2647
+
2648
+ it 'should convert hash to dsl (include hash array)' do
2649
+ h = {:glossary=>[
2650
+ {:title=>"example glossary",
2651
+ :date=>Time.parse('2016/05/21 00:00 UTC')},
2652
+ {:title=>"example glossary2",
2653
+ :date=>Time.parse('2016/05/21 00:01 UTC')}],
2654
+ :glossary2=>[
2655
+ {:title=>"example glossary",
2656
+ :date=>Time.parse('2016/05/21 00:00 UTC')}]}
2657
+
2658
+ dsl = Dslh.deval(h, :time_inspecter => proc {|i| i.to_s.inspect })
2659
+ expect(dsl).to eq(<<-EOS)
2660
+ glossary do |*|
2661
+ title "example glossary"
2662
+ date "2016-05-21 00:00:00 UTC"
2663
+ end
2664
+ glossary do |*|
2665
+ title "example glossary2"
2666
+ date "2016-05-21 00:01:00 UTC"
2667
+ end
2668
+ glossary2 do |*|
2669
+ title "example glossary"
2670
+ date "2016-05-21 00:00:00 UTC"
2671
+ end
2672
+ EOS
2673
+ end
2674
+
2675
+ it 'should convert dsl to hash (include hash array)' do
2676
+ h = {:glossary=>[
2677
+ {:title=>"example glossary",
2678
+ :date=>Time.parse('2016/05/21 00:00 UTC')},
2679
+ {:title=>"example glossary2",
2680
+ :date=>Time.parse('2016/05/21 00:01 UTC')}],
2681
+ :glossary2=>[
2682
+ {:title=>"example glossary",
2683
+ :date=>Time.parse('2016/05/21 00:00 UTC')}]}
2684
+
2685
+ hash = Dslh.eval do
2686
+ glossary do |*|
2687
+ title "example glossary"
2688
+ date "2016-05-21 00:00:00 UTC"
2689
+ end
2690
+ glossary do |*|
2691
+ title "example glossary2"
2692
+ date "2016-05-21 00:01:00 UTC"
2693
+ end
2694
+ glossary2 do |*|
2695
+ title "example glossary"
2696
+ date "2016-05-21 00:00:00 UTC"
2697
+ end
2698
+ end
2699
+
2700
+ expect(hash).to eq(
2701
+ {"glossary"=>[
2702
+ {"title"=>"example glossary",
2703
+ "date"=>'2016-05-21 00:00:00 UTC'},
2704
+ {"title"=>"example glossary2",
2705
+ "date"=>'2016-05-21 00:01:00 UTC'}],
2706
+ "glossary2"=>[
2707
+ {"title"=>"example glossary",
2708
+ "date"=>'2016-05-21 00:00:00 UTC'}]}
2709
+ )
2710
+ end
2679
2711
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dslh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara