Class: Raven::Context
- Inherits:
-
Object
- Object
- Raven::Context
- Defined in:
- lib/raven/context.rb
Instance Attribute Summary collapse
-
#extra ⇒ Object
Returns the value of attribute extra.
-
#os ⇒ Object
Returns the value of attribute os.
-
#rack_env ⇒ Object
Returns the value of attribute rack_env.
-
#runtime ⇒ Object
Returns the value of attribute runtime.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize ⇒ Context
Returns a new instance of Context.
15 16 17 18 19 20 21 22 |
# File 'lib/raven/context.rb', line 15 def initialize self.extra = {} self.os = self.class.os_context self.rack_env = nil self.runtime = self.class.runtime_context self. = {} self.user = {} end |
Instance Attribute Details
#extra ⇒ Object
Returns the value of attribute extra.
13 14 15 |
# File 'lib/raven/context.rb', line 13 def extra @extra end |
#os ⇒ Object
Returns the value of attribute os.
13 14 15 |
# File 'lib/raven/context.rb', line 13 def os @os end |
#rack_env ⇒ Object
Returns the value of attribute rack_env.
13 14 15 |
# File 'lib/raven/context.rb', line 13 def rack_env @rack_env end |
#runtime ⇒ Object
Returns the value of attribute runtime.
13 14 15 |
# File 'lib/raven/context.rb', line 13 def runtime @runtime end |
#tags ⇒ Object
Returns the value of attribute tags.
13 14 15 |
# File 'lib/raven/context.rb', line 13 def @tags end |
#user ⇒ Object
Returns the value of attribute user.
13 14 15 |
# File 'lib/raven/context.rb', line 13 def user @user end |
Class Method Details
.clear! ⇒ Object
9 10 11 |
# File 'lib/raven/context.rb', line 9 def self.clear! Thread.current[:sentry_context] = nil end |
.current ⇒ Object
5 6 7 |
# File 'lib/raven/context.rb', line 5 def self.current Thread.current[:sentry_context] ||= new end |
.os_context ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/raven/context.rb', line 25 def os_context @os_context ||= { "name" => Raven.sys_command("uname -s") || RbConfig::CONFIG["host_os"], "version" => Raven.sys_command("uname -v"), "build" => Raven.sys_command("uname -r"), "kernel_version" => Raven.sys_command("uname -a") || Raven.sys_command("ver") # windows } end |
.runtime_context ⇒ Object
34 35 36 37 38 39 |
# File 'lib/raven/context.rb', line 34 def runtime_context @runtime_context ||= { "name" => RbConfig::CONFIG["ruby_install_name"], "version" => Raven.sys_command("ruby -v") } end |