Skip to content

Commit

Permalink
Don't try to load ActiveSupport. Check Numeric const instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
relistan committed May 9, 2015
1 parent be69888 commit c21c3e9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/core_ext/numeric_bytes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copied from ActiveSupport 4.2.1 lib/active_support/core_ext/numeric/bytes.rb
# Modified from ActiveSupport 4.2.1 lib/active_support/core_ext/numeric/bytes.rb
#
# NOTE that THIS LICENSE ONLY APPLIES TO THIS FILE itself, not
# to the rest of the project.
Expand All @@ -25,9 +25,7 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
begin
require 'active_support/core_ext/numeric/bytes'
rescue LoadError
unless Numeric.constants.include?(:KILOBYTE)
class Numeric
KILOBYTE = 1024 unless defined? KILOBYTE
MEGABYTE = KILOBYTE * 1024 unless defined? MEGABYTE
Expand Down

0 comments on commit c21c3e9

Please sign in to comment.