rollbar 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +2 -2
- data/lib/rollbar/encoding.rb +15 -9
- data/lib/rollbar/encoding/encoder.rb +12 -3
- data/lib/rollbar/encoding/legacy_encoder.rb +11 -9
- data/lib/rollbar/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8387b8dd9b53558f27d84908e1f3ac8beb26204
|
4
|
+
data.tar.gz: d8eec2f09315894700991fbaf1765d30cd0c697d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15191d6677c822f80dadeb608d41e1cd35e778e15a4f2e49254bd954e2db4179127406c841f05910cee36a8d2be6adabbb70704f18e53f6b9da0c773bb231585
|
7
|
+
data.tar.gz: 59e4273d242a88151f509845334448c067eb63b97241785eb4b46db6fbe1afcb4a916760fa2351283df1b10357394c59026aaeb808784f5119295394123b1289
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.2.
|
1
|
+
# Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.2.1)](https://travis-ci.org/rollbar/rollbar-gem/branches)
|
2
2
|
|
3
3
|
<!-- RemoveNext -->
|
4
4
|
[Rollbar](https://rollbar.com) is an error tracking service for Ruby and other languages. The Rollbar service will alert you of problems with your code and help you understand them in a ways never possible before. We love it and we hope you will too.
|
@@ -12,7 +12,7 @@ This is the Ruby library for Rollbar. It will instrument many kinds of Ruby appl
|
|
12
12
|
Add this line to your application's Gemfile:
|
13
13
|
|
14
14
|
```ruby
|
15
|
-
gem 'rollbar', '~> 2.2.
|
15
|
+
gem 'rollbar', '~> 2.2.1'
|
16
16
|
```
|
17
17
|
|
18
18
|
And then execute:
|
data/lib/rollbar/encoding.rb
CHANGED
@@ -1,21 +1,27 @@
|
|
1
1
|
module Rollbar
|
2
2
|
module Encoding
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
return object unless can_be_encoded
|
7
|
-
|
8
|
-
encoding_class.new(object).encode
|
3
|
+
class << self
|
4
|
+
attr_accessor :encoding_class
|
9
5
|
end
|
10
6
|
|
11
|
-
def self.
|
7
|
+
def self.setup
|
12
8
|
if String.instance_methods.include?(:encode)
|
13
9
|
require 'rollbar/encoding/encoder'
|
14
|
-
Encoder
|
10
|
+
self.encoding_class = Rollbar::Encoding::Encoder
|
15
11
|
else
|
16
12
|
require 'rollbar/encoding/legacy_encoder'
|
17
|
-
LegacyEncoder
|
13
|
+
self.encoding_class = Rollbar::Encoding::LegacyEncoder
|
18
14
|
end
|
19
15
|
end
|
16
|
+
|
17
|
+
def self.encode(object)
|
18
|
+
can_be_encoded = object.is_a?(String) || object.is_a?(Symbol)
|
19
|
+
|
20
|
+
return object unless can_be_encoded
|
21
|
+
|
22
|
+
encoding_class.new(object).encode
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
26
|
+
|
27
|
+
Rollbar::Encoding.setup
|
@@ -4,6 +4,8 @@ module Rollbar
|
|
4
4
|
ALL_ENCODINGS = [::Encoding::UTF_8, ::Encoding::ISO_8859_1, ::Encoding::ASCII_8BIT, ::Encoding::US_ASCII]
|
5
5
|
ASCII_ENCODINGS = [::Encoding::US_ASCII, ::Encoding::ASCII_8BIT, ::Encoding::ISO_8859_1]
|
6
6
|
ENCODING_OPTIONS = { :invalid => :replace, :undef => :replace, :replace => '' }
|
7
|
+
UTF8 = 'UTF-8'.freeze
|
8
|
+
BINARY = 'binary'.freeze
|
7
9
|
|
8
10
|
attr_accessor :object
|
9
11
|
|
@@ -13,8 +15,14 @@ module Rollbar
|
|
13
15
|
|
14
16
|
def encode
|
15
17
|
value = object.to_s
|
18
|
+
encoding = value.encoding
|
16
19
|
|
17
|
-
|
20
|
+
# This will be most of cases so avoid force anything for them
|
21
|
+
if encoding == ::Encoding::UTF_8 && value.valid_encoding?
|
22
|
+
encoded_value = value
|
23
|
+
else
|
24
|
+
encoded_value = force_encoding(value).encode(*encoding_args(value))
|
25
|
+
end
|
18
26
|
|
19
27
|
object.is_a?(Symbol) ? encoded_value.to_sym : encoded_value
|
20
28
|
end
|
@@ -34,6 +42,7 @@ module Rollbar
|
|
34
42
|
|
35
43
|
ALL_ENCODINGS.detect do |encoding|
|
36
44
|
begin
|
45
|
+
# Seems #codepoints is faster than #valid_encoding?
|
37
46
|
value.force_encoding(encoding).encode(::Encoding::UTF_8).codepoints
|
38
47
|
true
|
39
48
|
rescue
|
@@ -43,8 +52,8 @@ module Rollbar
|
|
43
52
|
end
|
44
53
|
|
45
54
|
def encoding_args(value)
|
46
|
-
args = [
|
47
|
-
args <<
|
55
|
+
args = [UTF8]
|
56
|
+
args << BINARY if ASCII_ENCODINGS.include?(value.encoding)
|
48
57
|
args << ENCODING_OPTIONS
|
49
58
|
|
50
59
|
args
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'iconv'
|
2
2
|
|
3
3
|
module Rollbar
|
4
|
-
|
5
|
-
|
4
|
+
module Encoding
|
5
|
+
class LegacyEncoder
|
6
|
+
attr_accessor :object
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
def initialize(object)
|
9
|
+
@object = object
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def encode
|
13
|
+
value = object.to_s
|
14
|
+
encoded_value = ::Iconv.conv('UTF-8//IGNORE', 'UTF-8', value)
|
14
15
|
|
15
|
-
|
16
|
+
object.is_a?(Symbol) ? encoded_value.to_sym : encoded_value
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
data/lib/rollbar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rollbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rollbar, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -360,7 +360,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
360
360
|
version: '0'
|
361
361
|
requirements: []
|
362
362
|
rubyforge_project:
|
363
|
-
rubygems_version: 2.
|
363
|
+
rubygems_version: 2.3.0
|
364
364
|
signing_key:
|
365
365
|
specification_version: 4
|
366
366
|
summary: Reports exceptions to Rollbar
|