Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Cherry-pick Object#blank? extension #113

Merged
merged 1 commit into from

2 participants

@jpignata

Since ActiveSupport is modular just include the #blank? inflection extension rather than including all of the core extensions and active_support itself.

It seems heavy-handed to require all of ActiveSupport's core extensions as a side effect of including an exception reporting API. According to 2ba25e8 this include was required for #blank? and #to_xml. I found references to the former but didn't find any to the latter. This pull does two things:

  • Localizes the required code to active_support/core_ext/object/blank
  • Removes the begin/rescue/end block around the require as if this is in fact a requirement a LoadError should be raised if its missing

My motivation for this change is a problem I'm having with using Airbrake in a jruby application that makes use of threads. Due to the way autoload works, I'm seeing threads blocking each other when dealing with JSON coercion with active_support required.

@jpignata jpignata Cherry-pick Object#blank? extension
Since ActiveSupport is modular just include the blank inflection extension
rather than including all of the core extensions and active_support itself.
60a84bd
@shime

Makes a lot of sense. Yeah, I've checked and we're not using #to_xml from ActiveSupport, we're defining our own.

Since we're really including ActiveSupport only to use #blank?, a better solution would be to get rid of that dependency.

@shime shime merged commit 60a84bd into airbrake:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 25, 2012
  1. @jpignata

    Cherry-pick Object#blank? extension

    jpignata authored
    Since ActiveSupport is modular just include the blank inflection extension
    rather than including all of the core extensions and active_support itself.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 8 deletions.
  1. +1 −8 lib/airbrake.rb
View
9 lib/airbrake.rb
@@ -2,13 +2,7 @@
require 'net/http'
require 'net/https'
require 'rubygems'
-begin
- require 'active_support'
- require 'active_support/core_ext'
-rescue LoadError
- require 'activesupport'
- require 'activesupport/core_ext'
-end
+require 'active_support/core_ext/object/blank'
require 'airbrake/version'
require 'airbrake/configuration'
require 'airbrake/notice'
@@ -28,7 +22,6 @@ module Airbrake
'Accept' => 'text/xml, application/xml'
}
-
# Queue used to send async notices. Used only if configuration.async is
# set to true.
AIRBRAKE_QUEUE = GirlFriday::WorkQueue.new(nil,:size => 3) do |notice|
Something went wrong with that request. Please try again.