vcard 0.2.11 → 0.2.12

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: 811c33352212ba0e5a9490290ae75cf988169535
4
- data.tar.gz: 6aca3423ac347434f90e14fe1f49b61b5c540e16
3
+ metadata.gz: 2e912a9dfe65f2058669088fcb34f1be53147564
4
+ data.tar.gz: 3aad9b7c03a9f32a2173d3386985d075bb264fe6
5
5
  SHA512:
6
- metadata.gz: eea48a1f834674499f4a52f4655cb7dd22bdf918f072048457ab0c405613f243867433de00ef8c70468b24b50302df70c560a70d4b168be9bd8915e67d3ddcb6
7
- data.tar.gz: 34962466019666c8b7212446e5f025580109856115db59e2d9d59bbcc711c9fa6dfdc5df9e53f0b30a656b3ce3bd94ce7c3a38f0ab6b76f2a8c4f92cb40e7e57
6
+ metadata.gz: dbfb602829bfe1c2de00a99950c8783dd930fcd3de4099b84ab2089dda1b96f80ff2af39646e12f044ef235b248257290a07eafc6b5b042ba7d61129b98186bd
7
+ data.tar.gz: 33afb5ec28ca3e61b8077bec041a5b42e0cc850253fbf82238d68a044606cadf5dc3a50dc930dadc2585cddd9949256b3d8dcdcf1d3975ee42a432a04ff5dd8a
@@ -60,7 +60,12 @@ module Vcard
60
60
  # QSAFE-CHAR = WSP / %x21 / %x23-7E / NON-US-ASCII
61
61
  # ; Any character except CTLs and DQUOTE
62
62
  # set ascii encoding so that multibyte chars can be properly escaped
63
- QSAFECHAR = Regexp.new("[ \t\x21\x23-\x7e\x80-\xff]")
63
+ if RUBY_PLATFORM == "java" && RUBY_VERSION < "1.9"
64
+ # JRuby in 1.8 mode doesn't respect the file encoding. See https://github.com/jruby/jruby/issues/1191
65
+ QSAFECHAR = /[ \t\x21\x23-\x7e\x80-\xff]/
66
+ else
67
+ QSAFECHAR = Regexp.new("[ \t\x21\x23-\x7e\x80-\xff]")
68
+ end
64
69
  ALL_QSAFECHARS = /\A#{QSAFECHAR}*\z/
65
70
 
66
71
  # SAFE-CHAR = WSP / %x21 / %x23-2B / %x2D-39 / %x3C-7E / NON-US-ASCII
@@ -41,7 +41,11 @@ module Vcard
41
41
  # [<group>.]<name>;<pname>=<pvalue>,<pvalue>:<value>
42
42
 
43
43
  if group
44
- line << group << "."
44
+ if group.class == Symbol
45
+ # Explicitly allow symbols
46
+ group = group.to_s
47
+ end
48
+ line << group.to_str << "."
45
49
  end
46
50
 
47
51
  line << name
@@ -88,7 +92,7 @@ module Vcard
88
92
  line << value.map { |v| Field.value_str(v) }.join(";")
89
93
 
90
94
  when Symbol
91
- line << value
95
+ line << value.to_s
92
96
 
93
97
  else
94
98
  # FIXME - somewhere along here, values with special chars need escaping...
@@ -1,3 +1,3 @@
1
1
  module Vcard
2
- VERSION = "0.2.11"
2
+ VERSION = "0.2.12"
3
3
  end
@@ -107,13 +107,17 @@ class FieldTest < Test::Unit::TestCase
107
107
  assert_equal("Z.B", f.group)
108
108
  assert_equal("z.b.NAME:z\n", f.encode)
109
109
 
110
- assert_raises(TypeError) { f.value = :group }
110
+ f.value = :group
111
+ assert_equal("Z.B.NAME:group\n", f.encode)
112
+ f.value = "z"
111
113
 
112
114
  assert_equal("Z.B", f.group)
113
115
 
114
- assert_equal("z.b.NAME:z\n", f.encode)
116
+ assert_equal("Z.B.NAME:z\n", f.encode)
115
117
 
116
- assert_raises(TypeError) { f.group = :group }
118
+ f.group = :group
119
+ assert_equal("group.NAME:z\n", f.encode)
120
+ f.group = "z.b"
117
121
 
118
122
  assert_equal("z.b.NAME:z\n", f.encode)
119
123
  assert_equal("Z.B", f.group)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuba Kuźma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-02 00:00:00.000000000 Z
11
+ date: 2013-10-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Vcard extracted from Vpim
14
14
  email: