elster 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- elster (0.0.5)
4
+ elster (0.0.6)
5
5
  multi_json
6
6
 
7
7
  GEM
@@ -127,8 +127,9 @@ module Elster
127
127
  MultiJson.dump(value)
128
128
  end
129
129
 
130
+ SAFE_RE = Regexp.new("\\A[#{Regexp.escape((32..126).select{|c| c != 34}.map{|c| c.chr}.join)}]+\\z")
130
131
  def encode_string(value)
131
- if value =~ /\A[\w\d \t]+\Z/
132
+ if value =~ SAFE_RE
132
133
  "\"#{value}\""
133
134
  else
134
135
  encode_generic(value.to_s)
@@ -1,3 +1,3 @@
1
1
  module Elster
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -124,6 +124,13 @@ class StreamerTest < MiniTest::Unit::TestCase
124
124
  assert_equal [1, 2], parsed["an_array"]
125
125
  end
126
126
 
127
+ def test_string_with_cr_at_end
128
+ json.key("description", "I am \n")
129
+ json.close
130
+
131
+ assert_equal "I am \n", parsed["description"]
132
+ end
133
+
127
134
  def test_string_with_cr
128
135
  json.key("description", "I am \nmulti\nlined")
129
136
  json.close
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-20 00:00:00.000000000 Z
12
+ date: 2012-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -107,6 +107,7 @@ files:
107
107
  - /Users/jwebb/src/bigjason/elster/LICENSE
108
108
  - /Users/jwebb/src/bigjason/elster/pkg/elster-0.0.2.gem
109
109
  - /Users/jwebb/src/bigjason/elster/pkg/elster-0.0.3.gem
110
+ - /Users/jwebb/src/bigjason/elster/pkg/elster-0.0.5.gem
110
111
  - /Users/jwebb/src/bigjason/elster/Rakefile
111
112
  - /Users/jwebb/src/bigjason/elster/README.md
112
113
  - /Users/jwebb/src/bigjason/elster/test/streamer_test.rb
@@ -124,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
125
  version: '0'
125
126
  segments:
126
127
  - 0
127
- hash: 4222457560117527615
128
+ hash: 1630700077536672737
128
129
  required_rubygems_version: !ruby/object:Gem::Requirement
129
130
  none: false
130
131
  requirements:
@@ -133,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
134
  version: '0'
134
135
  segments:
135
136
  - 0
136
- hash: 4222457560117527615
137
+ hash: 1630700077536672737
137
138
  requirements: []
138
139
  rubyforge_project:
139
140
  rubygems_version: 1.8.24