simple-config 0.3.1 → 0.4.0

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: 5dbbe370cc11a379846501d44fc7d43a8b6cb37a
4
- data.tar.gz: 8c682713f0ce9f035ec58443624729e361061677
3
+ metadata.gz: 8f6e417ebe883edd814bf7fa407832573e4da94e
4
+ data.tar.gz: a892fce84441acb738543847613163c394a0d801
5
5
  SHA512:
6
- metadata.gz: 45b7b0a3e3db7ff3c8c75685c55d56bf1fe0eb2e01a0bb6c70277924824341bfc219bb1d8bc46f37778eb1ac5bc81ffde5ecc1d7f559ea2b84cc1388c825f46d
7
- data.tar.gz: 31921d2e57a1010f643a30b783cacd8b3e66ce084a9428d8702ee23393ebc85cf04fdb0ea2834ee4408b7f2f44bb66ad6b20869026e0a5e55db750193a0e99bf
6
+ metadata.gz: acc25c3a4d3cc25acc92e9edfddff090656be5599399be279ad663b78c6ddb3cfbdfe370dc831efe40ab65f5da3877dd3ef61f8e8a2a281c73adbfa3a08c6d79
7
+ data.tar.gz: 9d31e57787e4989ea9f0638cebb374934ed395a6eac2995d14a155698f4782459cd7ec18ea03cd5b58d948a1b9f387a348f3cb11769dc84e14548ec8e6c0cbc0
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1,6 @@
1
- _���K{��=��y g�ڕ�7 ����@xO��������@n+o�4F��S 2�?ܯ >g=:k+
2
- 9YO.>�y^��6$[��{�@3��CX�Ѿ^��_o]��q�B�RLk�U���"��An
3
- p^b���\������k G�r��<�3���j���-5V�%�0t�dB��f��e Y���F��*���Rz��8�d��w�d6Hث�3iז�� B��b0��W�Z���2��o
1
+ ]tA*���V�I�
2
+ #Ar%/�ZQ3
3
+ ��Z]/��2�B|a�
4
+
5
+ �0%z͎�jc�Z@w'�j)l>ͪ��Tc��}:$�5z��'j Tw7־ ��q����Kx����6k��*�}$x����!
6
+ ���F���E��� Ks���ȵG��n��-�����z1blK��a��lOa��PzS��S���#�$�
data/lib/simple-config.rb CHANGED
@@ -12,6 +12,7 @@ class SimpleConfig
12
12
 
13
13
  def initialize(x=nil)
14
14
 
15
+ @header = false
15
16
  m = {:String => :parse_to_h, :Hash => :write, :SimpleConfig => :passthru}
16
17
  method(m[x.class.to_s.to_sym]).call(x) if x
17
18
  end
@@ -20,16 +21,45 @@ class SimpleConfig
20
21
  parse_to_h(t || @to_s)
21
22
  end
22
23
 
23
- def write(h=nil)
24
+ def write(h=nil, header: @header)
25
+
24
26
  @to_h = h || @to_h
25
- scan_to_s @to_h
27
+
28
+ header = ''
29
+
30
+ if @header then
31
+
32
+ header = '<?simple-config'
33
+ header += ' ' + @type if @type
34
+ header += "?>\n"
35
+ end
36
+
37
+ @to_s = header + scan_to_s(@to_h)
38
+
39
+ end
40
+
41
+ def to_xml()
42
+
26
43
  end
27
44
 
28
45
  private
29
46
 
30
47
  def parse_to_h(s)
31
48
 
32
- txt, _ = RXFHelper.read(s)
49
+ raw_txt, _ = RXFHelper.read(s)
50
+
51
+ # does the raw_txt contain header information?
52
+ a = s.strip.lines
53
+
54
+ txt = if a[0][/^<\?simple-?config /] then
55
+ raw_header = a.shift
56
+ @type = raw_header[/type=["']([^"']+)/,1]
57
+ @header = true
58
+ a.join
59
+ else
60
+ raw_txt
61
+ end
62
+
33
63
  scan_to_h(txt)
34
64
  end
35
65
 
@@ -121,4 +151,4 @@ class SimpleConfig
121
151
  @to_s = a.join("\n")
122
152
  end
123
153
 
124
- end
154
+ end
data.tar.gz.sig CHANGED
@@ -1 +1,4 @@
1
- �d������eK|>�K��>e5z�*{���m}Ⱥԉh:��9(��x ��`,�v[L/�ʌ҄� ���;�6epup.^2b������lD��6��V9���y�����pQ[��-/�}u��ʱL�?��8�@eim[��0oht(8̑�S �\I�nwB&�F����t���&3 ~ތ�z)�YɚHb!8m;���U�%#l��8�&��O�^��%�r�ᇊt���7��ԃn�ީE� YC"����[�
1
+ SF�sJ .�8��ݞY>c�e�"-�鼻6���6��ٯ�oXTJz5�!3no-E��-�K� �xwJ˓��Z7g0u�������+��i=�V�$���.��j���Y0p�F
2
+ ֝
3
+ ,�*q�ϰ��
4
+ ���
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  GOyi72Dr1XTvfW8Vje543EzUeJP4EjrtsoS0tbx5hs2J8Ey8zv39aU4aNyM1h0Fv
32
32
  1BzvTQ2PY7IAEQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-03-29 00:00:00.000000000 Z
34
+ date: 2015-04-21 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: line-tree
metadata.gz.sig CHANGED
Binary file