rhcl 0.0.4 → 0.1.0

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: 9c2dfad2b024f0251ae293e7f15b77690731bb82
4
- data.tar.gz: 5836cb027e5aab9c42e51b9e7e1b547757397302
3
+ metadata.gz: 1b695aaa4c97d9c10ca368decfca0dddc645cc25
4
+ data.tar.gz: 02656190023a22d863ff3b6fb55b17a487df3fe5
5
5
  SHA512:
6
- metadata.gz: 66e61c3536485733c666deb6cb245d4e52fdac00f87b01fd645a7f2c5515e384e9b64061ab154265ac14eb5ebaf015a2e74f84170dc3f9740e95beff52f6848e
7
- data.tar.gz: 9f8636fdf14f6be1f39d53a51e0f0f469b01db9dc5bfdce3a3ec2c9e8f5ad652c163be149ed3e03a4d83ceb7252dcf58f854fc154ee1c1710544265a3ee53c12
6
+ metadata.gz: 2b033fbea3f185bb4e21802b28a7550374be604c18310de14e8f650526f415efe5253511cf36972a301b45b8e4f10ff5f35d60c14eb476eac35f4c881bfdbb27
7
+ data.tar.gz: ee88148096a6631951ef4a547c31e1fdf18536c755842fb51c0186a017335300a56f6b8afba2c8ca8883edd4945c920f1706bec29a969c28fb6f135b9c089fb4
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.11
3
+ # This file is automatically generated by Racc 1.4.12
4
4
  # from Racc grammer file "".
5
5
  #
6
6
 
@@ -14,6 +14,10 @@ module Rhcl
14
14
 
15
15
  module_eval(<<'...end parse.y/module_eval...', 'parse.y', 107)
16
16
 
17
+ TRUE_VALUES = %w(true on yes)
18
+ FALSE_VALUES = %w(false off no )
19
+ BOOLEAN_VALUES = TRUE_VALUES + FALSE_VALUES
20
+
17
21
  def initialize(obj)
18
22
  src = obj.is_a?(IO) ? obj.read : obj.to_s
19
23
  @ss = StringScanner.new(src)
@@ -70,8 +74,8 @@ def scan
70
74
  identifier = (backup { @ss.scan_until /(\s|\z)/ } || '').sub(/\s\z/, '')
71
75
  token_type = :IDENTIFIER
72
76
 
73
- if ['true', 'false'].include?(identifier)
74
- identifier = !!(identifier =~ /true/)
77
+ if BOOLEAN_VALUES.include?(identifier)
78
+ identifier = TRUE_VALUES.include?(identifier)
75
79
  token_type = :BOOL
76
80
  end
77
81
 
@@ -105,6 +105,10 @@ require 'strscan'
105
105
 
106
106
  ---- inner
107
107
 
108
+ TRUE_VALUES = %w(true on yes)
109
+ FALSE_VALUES = %w(false off no )
110
+ BOOLEAN_VALUES = TRUE_VALUES + FALSE_VALUES
111
+
108
112
  def initialize(obj)
109
113
  src = obj.is_a?(IO) ? obj.read : obj.to_s
110
114
  @ss = StringScanner.new(src)
@@ -161,8 +165,8 @@ def scan
161
165
  identifier = (backup { @ss.scan_until /(\s|\z)/ } || '').sub(/\s\z/, '')
162
166
  token_type = :IDENTIFIER
163
167
 
164
- if ['true', 'false'].include?(identifier)
165
- identifier = !!(identifier =~ /true/)
168
+ if BOOLEAN_VALUES.include?(identifier)
169
+ identifier = TRUE_VALUES.include?(identifier)
166
170
  token_type = :BOOL
167
171
  end
168
172
 
@@ -1,3 +1,3 @@
1
1
  module Rhcl
2
- VERSION = '0.0.4'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -323,4 +323,24 @@ output "web_ip" {
323
323
  "output"=>{"web_ip"=>{"value"=>"${aws_instance.web.private_ip}"}}}
324
324
  )
325
325
  end
326
+
327
+ it 'bool types' do
328
+ parsed = Rhcl.parse(<<-EOS)
329
+ foo = true
330
+ bar = false
331
+ zoo = on
332
+ foo2 = off
333
+ bar2 = yes
334
+ zoo2 = no
335
+ EOS
336
+
337
+ expect(parsed).to eq(
338
+ {"foo"=>true,
339
+ "bar"=>false,
340
+ "zoo"=>true,
341
+ "foo2"=>false,
342
+ "bar2"=>true,
343
+ "zoo2"=>false}
344
+ )
345
+ end
326
346
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhcl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-14 00:00:00.000000000 Z
11
+ date: 2014-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.4.1
126
+ rubygems_version: 2.0.14
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Pure Ruby HCL parser