anvl 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/VERSION +1 -1
  2. data/anvl.gemspec +2 -2
  3. data/lib/anvl.rb +7 -5
  4. data/test/test_anvl.rb +13 -1
  5. metadata +13 -13
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{anvl}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Chris Beer"]
12
- s.date = %q{2010-11-28}
12
+ s.date = %q{2010-12-09}
13
13
  s.email = %q{chris@cbeer.info}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
@@ -22,9 +22,11 @@ module ANVL
22
22
  lines.each_with_index do |str, i|
23
23
  case str
24
24
  when /^#/
25
- parse_comment str, i
26
- else
27
- parse_entry str, i
25
+ parse_comment str, i
26
+ when /:/
27
+ parse_entry str, i
28
+ else # something is wrong..
29
+ nil
28
30
  end
29
31
  end
30
32
 
@@ -40,10 +42,10 @@ module ANVL
40
42
  @entries.map do |key, value|
41
43
  if value.is_a? Array
42
44
  value.map do |v|
43
- "#{key}: #{v}"
45
+ "#{key}: #{v.to_s.gsub(/\n/, "\n ")}"
44
46
  end
45
47
  else
46
- "#{key}: #{value}"
48
+ "#{key}: #{value.to_s.gsub(/\n/, "\n ")}"
47
49
  end
48
50
  end.join "\n"
49
51
  end
@@ -54,7 +54,19 @@ a: 2'
54
54
  h << { :c => 2 }
55
55
  assert_equal([1, 2], h[:c])
56
56
 
57
- assert_equal("a: a\na: b\na: c\na: d\nc: 1\nc: 2", h.to_s)
57
+ str = h.to_s
58
+ assert_match(/^a: a$/, str)
59
+ assert_match(/^a: b$/, str)
60
+ assert_match(/^a: c$/, str)
61
+ assert_match(/^a: d$/, str)
62
+ assert_match(/^c: 1$/, str)
63
+ assert_match(/^c: 2$/, str)
64
+ end
65
+
66
+ def test_newlines
67
+ h = ANVL::Document.new
68
+ h[:nl] = "abc\n123"
69
+ assert_equal("nl: abc\n 123", h.to_s)
58
70
  end
59
71
 
60
72
  def test_fmt_empty
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anvl
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Beer
@@ -15,13 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-28 00:00:00 -05:00
18
+ date: 2010-12-09 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- type: :development
23
- prerelease: false
24
- name: shoulda
25
22
  version_requirements: &id001 !ruby/object:Gem::Requirement
26
23
  none: false
27
24
  requirements:
@@ -31,11 +28,11 @@ dependencies:
31
28
  segments:
32
29
  - 0
33
30
  version: "0"
31
+ name: shoulda
34
32
  requirement: *id001
35
- - !ruby/object:Gem::Dependency
36
33
  type: :development
37
34
  prerelease: false
38
- name: bundler
35
+ - !ruby/object:Gem::Dependency
39
36
  version_requirements: &id002 !ruby/object:Gem::Requirement
40
37
  none: false
41
38
  requirements:
@@ -47,11 +44,11 @@ dependencies:
47
44
  - 0
48
45
  - 0
49
46
  version: 1.0.0
47
+ name: bundler
50
48
  requirement: *id002
51
- - !ruby/object:Gem::Dependency
52
49
  type: :development
53
50
  prerelease: false
54
- name: jeweler
51
+ - !ruby/object:Gem::Dependency
55
52
  version_requirements: &id003 !ruby/object:Gem::Requirement
56
53
  none: false
57
54
  requirements:
@@ -63,11 +60,11 @@ dependencies:
63
60
  - 5
64
61
  - 1
65
62
  version: 1.5.1
63
+ name: jeweler
66
64
  requirement: *id003
67
- - !ruby/object:Gem::Dependency
68
65
  type: :development
69
66
  prerelease: false
70
- name: rcov
67
+ - !ruby/object:Gem::Dependency
71
68
  version_requirements: &id004 !ruby/object:Gem::Requirement
72
69
  none: false
73
70
  requirements:
@@ -77,7 +74,10 @@ dependencies:
77
74
  segments:
78
75
  - 0
79
76
  version: "0"
77
+ name: rcov
80
78
  requirement: *id004
79
+ type: :development
80
+ prerelease: false
81
81
  description:
82
82
  email: chris@cbeer.info
83
83
  executables: []