rollbar 3.3.0 → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,13 +5,8 @@ module Rollbar
5
5
  end
6
6
 
7
7
  def self.setup
8
- if String.instance_methods.include?(:encode)
9
- require 'rollbar/encoding/encoder'
10
- self.encoding_class = Rollbar::Encoding::Encoder
11
- else
12
- require 'rollbar/encoding/legacy_encoder'
13
- self.encoding_class = Rollbar::Encoding::LegacyEncoder
14
- end
8
+ require 'rollbar/encoding/encoder'
9
+ self.encoding_class = Rollbar::Encoding::Encoder
15
10
  end
16
11
 
17
12
  def self.encode(object)
@@ -32,6 +32,8 @@ module Rollbar
32
32
  end
33
33
 
34
34
  def locals_for(frame)
35
+ return {} unless frame
36
+
35
37
  {}.tap do |hash|
36
38
  frame.local_variables.map do |var|
37
39
  hash[var] = prepare_value(frame.local_variable_get(var))
@@ -1,8 +1,12 @@
1
- # Allows a Ruby String to be used to create native Javascript objects
2
- # when calling JSON#generate.
1
+ # Allows a Ruby String to be used to pass native Javascript objects/functions
2
+ # when calling JSON#generate with a Rollbar::JSON::JsOptionsState instance.
3
3
  #
4
4
  # Example:
5
- # JSON.generate({ foo: Rollbar::JSON::Value.new('function(){ alert("bar") }') })
5
+ # JSON.generate(
6
+ # { foo: Rollbar::JSON::Value.new('function(){ alert("bar") }') },
7
+ # Rollbar::JSON::JsOptionsState.new
8
+ # )
9
+ #
6
10
  # => '{"foo":function(){ alert(\"bar\") }}'
7
11
  #
8
12
  # MUST use the Ruby JSON encoder, as in the example. The ActiveSupport encoder,
@@ -11,6 +15,8 @@
11
15
  #
12
16
  module Rollbar
13
17
  module JSON
18
+ class JsOptionsState < ::JSON::State; end
19
+
14
20
  class Value # :nodoc:
15
21
  attr_accessor :value
16
22
 
@@ -18,8 +24,12 @@ module Rollbar
18
24
  @value = value
19
25
  end
20
26
 
21
- def to_json(*_args)
22
- value
27
+ def to_json(opts = {})
28
+ # Return the raw value if this is from the js middleware
29
+ return value if opts.class == Rollbar::JSON::JsOptionsState
30
+
31
+ # Otherwise convert to a string
32
+ %Q["#{value}"]
23
33
  end
24
34
  end
25
35
  end
@@ -134,6 +134,7 @@ module Rollbar
134
134
 
135
135
  def config_js_tag(env)
136
136
  require 'json'
137
+ require 'rollbar/middleware/js/json_value'
137
138
 
138
139
  js_config = Rollbar::Util.deep_copy(config[:options])
139
140
 
@@ -141,7 +142,7 @@ module Rollbar
141
142
 
142
143
  # MUST use the Ruby JSON encoder (JSON#generate).
143
144
  # See lib/rollbar/middleware/js/json_value
144
- json = ::JSON.generate(js_config)
145
+ json = ::JSON.generate(js_config, Rollbar::JSON::JsOptionsState.new)
145
146
 
146
147
  script_tag("var _rollbarConfig = #{json};", env)
147
148
  end
@@ -166,10 +167,9 @@ module Rollbar
166
167
  def script_tag(content, env)
167
168
  nonce = rails5_nonce(env) || secure_headers_nonce(env)
168
169
  script_tag_content = if nonce
169
- "\n<script type=\"text/javascript\" " \
170
- "nonce=\"#{nonce}\">#{content}</script>"
170
+ "\n<script nonce=\"#{nonce}\">#{content}</script>"
171
171
  else
172
- "\n<script type=\"text/javascript\">#{content}</script>"
172
+ "\n<script>#{content}</script>"
173
173
  end
174
174
 
175
175
  html_safe_if_needed(script_tag_content)
@@ -4,7 +4,7 @@ module Rollbar
4
4
  module ShowExceptions
5
5
  include ExceptionReporter
6
6
 
7
- def render_exception_with_rollbar(env, exception)
7
+ def render_exception_with_rollbar(env, exception, wrapper = nil)
8
8
  key = 'action_dispatch.show_detailed_exceptions'
9
9
 
10
10
  if exception.is_a?(ActionController::RoutingError) && env[key]
@@ -15,7 +15,12 @@ module Rollbar
15
15
  end
16
16
  end
17
17
 
18
- render_exception_without_rollbar(env, exception)
18
+ # Rails 7.1 changes the method signature for render_exception.
19
+ if self.class.instance_method(:render_exception_without_rollbar).arity == 2
20
+ render_exception_without_rollbar(env, exception)
21
+ else
22
+ render_exception_without_rollbar(env, exception, wrapper)
23
+ end
19
24
  end
20
25
 
21
26
  def call_with_rollbar(env)
@@ -55,13 +55,21 @@ module Rollbar
55
55
 
56
56
  def frame(trace)
57
57
  {
58
- :binding => trace.binding,
58
+ :binding => binding(trace),
59
59
  :defined_class => trace.defined_class,
60
60
  :method_id => trace.method_id,
61
61
  :path => trace.path,
62
62
  :lineno => trace.lineno
63
63
  }
64
64
  end
65
+
66
+ def binding(trace)
67
+ trace.binding
68
+ rescue StandardError
69
+ # Ruby internals will raise if we're on a Fiber,
70
+ # since bindings aren't valid on Fibers.
71
+ nil
72
+ end
65
73
  end
66
74
  end
67
75
  end
@@ -27,5 +27,9 @@ if defined?(ActiveSupport) && ActiveSupport.respond_to?(:on_load)
27
27
  ActionMailer::DeliveryJob.send(:include,
28
28
  Rollbar::ActiveJob)
29
29
  end
30
+ # Rails >= 6.0
31
+ if defined?(ActionMailer::MailDeliveryJob)
32
+ ActionMailer::MailDeliveryJob.send(:include, Rollbar::ActiveJob)
33
+ end
30
34
  end
31
35
  end
@@ -50,7 +50,8 @@ module Rollbar
50
50
  def self.scrub_params(params)
51
51
  options = {
52
52
  :params => params,
53
- :config => Rollbar.configuration.scrub_fields
53
+ :config => Rollbar.configuration.scrub_fields,
54
+ :whitelist => Rollbar.configuration.scrub_whitelist
54
55
  }
55
56
 
56
57
  Rollbar::Scrubbers::Params.call(options)
@@ -12,7 +12,7 @@ Rollbar.plugins.define('sidekiq >= 3') do
12
12
  chain.add Rollbar::Sidekiq::ResetScope
13
13
  end
14
14
 
15
- config.error_handlers << proc do |e, context|
15
+ config.error_handlers << proc do |e, context, _sidekiq_config = nil|
16
16
  Rollbar::Sidekiq.handle_exception(context, e)
17
17
  end
18
18
  end
@@ -214,7 +214,7 @@ module Rollbar
214
214
  return {} unless correct_method
215
215
  return {} unless json_request?(rack_req)
216
216
 
217
- raw_body = rack_req.body.read
217
+ raw_body = read_raw_body(rack_req.body)
218
218
  begin
219
219
  Rollbar::JSON.load(raw_body)
220
220
  rescue StandardError
@@ -222,8 +222,15 @@ module Rollbar
222
222
  end
223
223
  rescue StandardError
224
224
  {}
225
- ensure
226
- rack_req.body.rewind
225
+ end
226
+
227
+ def read_raw_body(body)
228
+ return {} unless body.respond_to?(:rewind)
229
+
230
+ body.rewind
231
+ raw_body = body.read
232
+ body.rewind
233
+ raw_body
227
234
  end
228
235
 
229
236
  def json_request?(rack_req)
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = '3.3.0'.freeze
2
+ VERSION = '3.4.2'.freeze
3
3
  end
data/rollbar.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
7
7
 
8
8
  gem.authors = ['Rollbar, Inc.']
9
9
  gem.email = ['support@rollbar.com']
10
- gem.description = 'Easy and powerful exception tracking for Ruby'
10
+ gem.description = "Track and debug errors in your Ruby applications with ease using Rollbar. With this gem, you can easily monitor and report on exceptions and other errors in your code, helping you identify and fix issues more quickly. Rollbar's intuitive interface and advanced error tracking features make it the perfect tool for ensuring the stability and reliability of your Ruby applications."
11
11
  gem.executables = ['rollbar-rails-runner']
12
12
  gem.summary = 'Reports exceptions to Rollbar'
13
13
  gem.homepage = 'https://rollbar.com'
metadata CHANGED
@@ -1,16 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rollbar, Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-27 00:00:00.000000000 Z
11
+ date: 2023-12-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Easy and powerful exception tracking for Ruby
13
+ description: Track and debug errors in your Ruby applications with ease using Rollbar.
14
+ With this gem, you can easily monitor and report on exceptions and other errors
15
+ in your code, helping you identify and fix issues more quickly. Rollbar's intuitive
16
+ interface and advanced error tracking features make it the perfect tool for ensuring
17
+ the stability and reliability of your Ruby applications.
14
18
  email:
15
19
  - support@rollbar.com
16
20
  executables:
@@ -37,17 +41,13 @@ files:
37
41
  - data/rollbar.snippet.js
38
42
  - docs/configuration.md
39
43
  - docs/plugins.md
40
- - gemfiles/rails30.gemfile
41
- - gemfiles/rails31.gemfile
42
- - gemfiles/rails32.gemfile
43
- - gemfiles/rails40.gemfile
44
- - gemfiles/rails41.gemfile
45
- - gemfiles/rails42.gemfile
46
44
  - gemfiles/rails50.gemfile
47
45
  - gemfiles/rails51.gemfile
48
46
  - gemfiles/rails52.gemfile
49
47
  - gemfiles/rails60.gemfile
50
48
  - gemfiles/rails61.gemfile
49
+ - gemfiles/rails70.gemfile
50
+ - gemfiles/rails71.gemfile
51
51
  - lib/generators/rollbar/rollbar_generator.rb
52
52
  - lib/generators/rollbar/templates/initializer.erb
53
53
  - lib/rails/rollbar_runner.rb
@@ -67,7 +67,6 @@ files:
67
67
  - lib/rollbar/deploy.rb
68
68
  - lib/rollbar/encoding.rb
69
69
  - lib/rollbar/encoding/encoder.rb
70
- - lib/rollbar/encoding/legacy_encoder.rb
71
70
  - lib/rollbar/exception_reporter.rb
72
71
  - lib/rollbar/exceptions.rb
73
72
  - lib/rollbar/item.rb
@@ -146,7 +145,7 @@ metadata:
146
145
  bug_tracker_uri: https://github.com/rollbar/rollbar-gem/issues
147
146
  homepage_uri: https://rollbar.com/
148
147
  documentation_uri: https://docs.rollbar.com/docs/ruby
149
- post_install_message:
148
+ post_install_message:
150
149
  rdoc_options: []
151
150
  require_paths:
152
151
  - lib
@@ -161,8 +160,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
160
  - !ruby/object:Gem::Version
162
161
  version: '0'
163
162
  requirements: []
164
- rubygems_version: 3.1.4
165
- signing_key:
163
+ rubygems_version: 3.4.10
164
+ signing_key:
166
165
  specification_version: 4
167
166
  summary: Reports exceptions to Rollbar
168
167
  test_files: []
@@ -1,51 +0,0 @@
1
- require 'rubygems/version'
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
6
- gem 'hitimes', '< 1.2.2'
7
- gem 'jruby-openssl', :platform => :jruby
8
- gem 'mixlib-shellout', '<= 2.0.0'
9
- gem 'net-ssh', '<= 3.1.1'
10
- gem 'public_suffix', '<= 2.0.5'
11
- gem 'rails', '~> 3.0.20'
12
- gem 'rake', '< 11'
13
- gem 'rspec-rails', '>= 2.14.0'
14
- gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw]
15
-
16
- if RUBY_VERSION < '2.2.2'
17
- gem 'sidekiq', '~> 2.13.0'
18
- else
19
- gem 'sidekiq', '>= 2.13.0'
20
- end
21
-
22
- platforms :rbx do
23
- gem 'minitest'
24
- gem 'racc'
25
- gem 'rubinius-developer_tools'
26
- gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
27
- gem 'rubysl-test-unit'
28
- end
29
-
30
- gem 'capistrano', :require => false
31
- gem 'codacy-coverage'
32
- gem 'rexml', '<= 3.2.4'
33
- gem 'shoryuken'
34
- gem 'simplecov', '<= 0.17.1'
35
- gem 'sucker_punch', '~> 2.0'
36
-
37
- gem 'database_cleaner', '~> 1.0.0'
38
- gem 'delayed_job', :require => false
39
- gem 'genspec', '>= 0.2.8'
40
- gem 'girl_friday', '>= 0.11.1'
41
- gem 'redis', '<= 3.3.5'
42
- gem 'redis-namespace', '<= 1.5.0'
43
- gem 'rspec-command'
44
- gem 'sinatra'
45
-
46
- gem 'webmock', :require => false
47
-
48
- gem 'aws-sdk-sqs'
49
- gem 'resque', '< 2.0.0'
50
-
51
- gemspec :path => '../'
@@ -1,51 +0,0 @@
1
- require 'rubygems/version'
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
6
- gem 'jruby-openssl', :platform => :jruby
7
- gem 'mixlib-shellout', '<= 2.0.0'
8
- gem 'net-ssh', '<= 3.1.1'
9
- gem 'public_suffix', '<= 2.0.5'
10
- gem 'rails', '~> 3.1.12'
11
- gem 'rake', '< 11'
12
- gem 'rspec-rails', '~> 3.4'
13
- gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw]
14
-
15
- if RUBY_VERSION < '2.2.2'
16
- gem 'sidekiq', '~> 2.13.0'
17
- else
18
- gem 'sidekiq', '>= 2.13.0'
19
- end
20
-
21
- platforms :rbx do
22
- gem 'minitest'
23
- gem 'racc'
24
- gem 'rubinius-developer_tools'
25
- gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
26
- gem 'rubysl-test-unit'
27
- end
28
-
29
- gem 'capistrano', :require => false
30
- gem 'codacy-coverage'
31
- gem 'rexml', '<= 3.2.4'
32
- gem 'shoryuken'
33
- gem 'simplecov', '<= 0.17.1'
34
- gem 'sucker_punch'
35
-
36
- gem 'database_cleaner'
37
- gem 'delayed_job', :require => false
38
- gem 'generator_spec'
39
- gem 'girl_friday'
40
- gem 'rack-cache', '<= 1.9.0'
41
- gem 'redis', '<= 3.3.5'
42
- gem 'redis-namespace', '<= 1.5.0'
43
- gem 'rspec-command'
44
- gem 'sinatra'
45
-
46
- gem 'webmock', :require => false
47
-
48
- gem 'aws-sdk-sqs'
49
- gem 'resque', '< 2.0.0'
50
-
51
- gemspec :path => '../'
@@ -1,53 +0,0 @@
1
- require 'rubygems/version'
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
6
- gem 'jruby-openssl', :platform => :jruby
7
- gem 'mixlib-shellout', '<= 2.0.0'
8
- gem 'net-ssh', '<= 3.1.1'
9
- gem 'public_suffix', '<= 2.0.5'
10
- gem 'rails', '~> 3.2.22'
11
- gem 'rake'
12
- gem 'rspec-rails', '~> 3.4'
13
- gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw]
14
- # Please see https://github.com/rspec/rspec-rails/issues/1273
15
- gem 'test-unit'
16
-
17
- if RUBY_VERSION < '2.2.2'
18
- gem 'sidekiq', '~> 2.13.0'
19
- else
20
- gem 'sidekiq', '>= 2.13.0'
21
- end
22
-
23
- platforms :rbx do
24
- gem 'minitest'
25
- gem 'racc'
26
- gem 'rubinius-developer_tools'
27
- gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
28
- gem 'rubysl-test-unit'
29
- end
30
-
31
- gem 'capistrano', :require => false
32
- gem 'codacy-coverage'
33
- gem 'rexml', '<= 3.2.4'
34
- gem 'shoryuken'
35
- gem 'simplecov', '<= 0.17.1'
36
- gem 'sucker_punch', '~> 2.0'
37
-
38
- gem 'delayed_job', :require => false
39
- gem 'redis', '<= 3.3.5'
40
- gem 'redis-namespace', '<= 1.5.0'
41
- gem 'sinatra'
42
-
43
- gem 'database_cleaner', '~> 1.0.0'
44
- gem 'generator_spec'
45
- gem 'girl_friday', '>= 0.11.1'
46
- gem 'rspec-command'
47
-
48
- gem 'webmock', :require => false
49
-
50
- gem 'aws-sdk-sqs'
51
- gem 'resque', '< 2.0.0'
52
-
53
- gemspec :path => '../'
@@ -1,53 +0,0 @@
1
- require 'rubygems/version'
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
6
- gem 'jruby-openssl', :platform => :jruby
7
- gem 'mixlib-shellout', '<= 2.0.0'
8
- gem 'net-ssh', '<= 3.1.1'
9
- gem 'public_suffix', '<= 2.0.5'
10
- gem 'rails', '~> 4.0.13'
11
- gem 'rake'
12
- gem 'rspec-rails', '~> 3.4'
13
- gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw]
14
- # Please see https://github.com/rspec/rspec-rails/issues/1273
15
- gem 'test-unit'
16
-
17
- if RUBY_VERSION < '2.2.2'
18
- gem 'sidekiq', '~> 2.13.0'
19
- else
20
- gem 'sidekiq', '>= 2.13.0'
21
- end
22
-
23
- platforms :rbx do
24
- gem 'minitest'
25
- gem 'racc'
26
- gem 'rubinius-developer_tools'
27
- gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
28
- gem 'rubysl-test-unit'
29
- end
30
-
31
- gem 'capistrano', :require => false
32
- gem 'codacy-coverage'
33
- gem 'json', '~> 2.0'
34
- gem 'shoryuken'
35
- gem 'simplecov', '<= 0.17.1'
36
- gem 'sucker_punch', '~> 2.0'
37
-
38
- gem 'delayed_job', :require => false
39
- gem 'redis', '<= 3.3.5'
40
- gem 'redis-namespace', '<= 1.5.0'
41
- gem 'resque'
42
- gem 'sinatra'
43
-
44
- gem 'database_cleaner', '~> 1.0.0'
45
- gem 'generator_spec'
46
- gem 'girl_friday', '>= 0.11.1'
47
- gem 'rspec-command'
48
-
49
- gem 'webmock', :require => false
50
-
51
- gem 'aws-sdk-sqs'
52
-
53
- gemspec :path => '../'
@@ -1,49 +0,0 @@
1
- require 'rubygems/version'
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
6
- gem 'jruby-openssl', :platform => :jruby
7
- gem 'mixlib-shellout', '<= 2.0.0'
8
- gem 'net-ssh', '<= 3.1.1'
9
- gem 'public_suffix', '<= 2.0.5'
10
- gem 'rails', '~> 4.1.16'
11
- gem 'rake'
12
- gem 'rspec-rails', '~> 3.4'
13
- gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw]
14
-
15
- if RUBY_VERSION < '2.2.2'
16
- gem 'sidekiq', '~> 2.13.0'
17
- else
18
- gem 'sidekiq', '>= 2.13.0'
19
- end
20
-
21
- platforms :rbx do
22
- gem 'minitest'
23
- gem 'racc'
24
- gem 'rubinius-developer_tools'
25
- gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
26
- end
27
-
28
- gem 'capistrano', :require => false
29
- gem 'codacy-coverage'
30
- gem 'shoryuken'
31
- gem 'simplecov', '<= 0.17.1'
32
- gem 'sucker_punch', '~> 2.0'
33
-
34
- gem 'delayed_job', :require => false
35
- gem 'redis', '<= 3.3.5'
36
- gem 'redis-namespace', '<= 1.5.0'
37
- gem 'resque'
38
- gem 'sinatra'
39
-
40
- gem 'database_cleaner', '~> 1.0.0'
41
- gem 'generator_spec'
42
- gem 'girl_friday', '>= 0.11.1'
43
- gem 'rspec-command'
44
-
45
- gem 'webmock', :require => false
46
-
47
- gem 'aws-sdk-sqs'
48
-
49
- gemspec :path => '../'
@@ -1,50 +0,0 @@
1
- require 'rubygems/version'
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
6
- gem 'jruby-openssl', :platform => :jruby
7
- gem 'net-ssh', '<= 3.1.1'
8
- gem 'public_suffix', '<= 2.0.5'
9
- gem 'rails', '~> 4.2.11'
10
- gem 'rake'
11
- gem 'rspec-rails', '~> 3.4'
12
- gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw]
13
-
14
- platforms :rbx do
15
- gem 'minitest'
16
- gem 'racc'
17
- gem 'rubinius-developer_tools'
18
- gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
19
- end
20
-
21
- gem 'json', '1.8.6' if RUBY_VERSION < '2.0.0'
22
-
23
- if RUBY_VERSION < '2.2.2'
24
- gem 'sidekiq', '~> 2.13.0'
25
- else
26
- gem 'sidekiq', '>= 2.13.0'
27
- end
28
-
29
- gem 'capistrano', :require => false
30
- gem 'shoryuken'
31
-
32
- gem 'database_cleaner', '~> 1.0.0'
33
- gem 'delayed_job', :require => false
34
- gem 'generator_spec'
35
- gem 'girl_friday', '>= 0.11.1'
36
- gem 'redis', '<= 3.3.5'
37
- gem 'resque'
38
- gem 'rspec-command'
39
- gem 'sinatra'
40
-
41
- gem 'nokogiri', '~> 1.6.0' if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('2.0')
42
-
43
- gem 'codacy-coverage'
44
- gem 'simplecov', '<= 0.17.1'
45
- gem 'sucker_punch', '~> 2.0'
46
- gem 'webmock', :require => false
47
-
48
- gem 'aws-sdk-sqs'
49
-
50
- gemspec :path => '../'
@@ -1,20 +0,0 @@
1
- require 'iconv'
2
-
3
- module Rollbar
4
- module Encoding
5
- class LegacyEncoder
6
- attr_accessor :object
7
-
8
- def initialize(object)
9
- @object = object
10
- end
11
-
12
- def encode
13
- value = object.to_s
14
- encoded_value = ::Iconv.conv('UTF-8//IGNORE', 'UTF-8', value)
15
-
16
- object.is_a?(Symbol) ? encoded_value.to_sym : encoded_value
17
- end
18
- end
19
- end
20
- end