Class: Chatterbox::ExceptionNotification::Extracter
- Inherits:
-
Object
- Object
- Chatterbox::ExceptionNotification::Extracter
- Defined in:
- lib/chatterbox/exception_notification/extracter.rb
Class Method Summary collapse
Instance Method Summary collapse
- #extract_default_info(hash) ⇒ Object
- #extract_exception_info(hash) ⇒ Object
- #extract_ruby_info(hash) ⇒ Object
-
#initialize(notification) ⇒ Extracter
constructor
A new instance of Extracter.
- #notice ⇒ Object
Constructor Details
#initialize(notification) ⇒ Extracter
Returns a new instance of Extracter.
7 8 9 |
# File 'lib/chatterbox/exception_notification/extracter.rb', line 7 def initialize(notification) @notification = notification end |
Class Method Details
.wrap(notification = {}) ⇒ Object
3 4 5 |
# File 'lib/chatterbox/exception_notification/extracter.rb', line 3 def self.wrap(notification = {}) new(notification).notice end |
Instance Method Details
#extract_default_info(hash) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/chatterbox/exception_notification/extracter.rb', line 17 def extract_default_info(hash) hsh = { :summary => "N/A", :environment => ENV.to_hash, :chatterbox_info => "Chatterbox Version #{Chatterbox::Version::STRING}" }.merge(hash) end |
#extract_exception_info(hash) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/chatterbox/exception_notification/extracter.rb', line 24 def extract_exception_info(hash) return hash unless hash.key?(:exception) exception = hash[:exception] { :summary => "#{exception.class.name}: #{exception.}", :error_class => exception.class.name, :error_message => exception., :backtrace => exception.backtrace, }.merge(hash) end |
#extract_ruby_info(hash) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/chatterbox/exception_notification/extracter.rb', line 35 def extract_ruby_info(hash) hash.merge({ :ruby_info => { :ruby_version => RUBY_VERSION, :ruby_platform => RUBY_PLATFORM } }) end |
#notice ⇒ Object
11 12 13 14 15 |
# File 'lib/chatterbox/exception_notification/extracter.rb', line 11 def notice hash = extract_exception_info(@notification) hash = extract_ruby_info(hash) extract_default_info(hash) end |