Skip to content

Commit

Permalink
Do not require active_support/core_ext/nil
Browse files Browse the repository at this point in the history
It doesn't exist; just require object, where NilClass is monkey-patched.
  • Loading branch information
shioyama committed Mar 11, 2017
1 parent 094044a commit 39e2459
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/mobility.rb
Expand Up @@ -2,7 +2,7 @@
require 'request_store'
require 'mobility/version'

%w[object nil string].each do |type|
%w[object string].each do |type|
begin
require "active_support/core_ext/#{type}"
rescue LoadError
Expand Down
10 changes: 0 additions & 10 deletions lib/mobility/core_ext/nil.rb

This file was deleted.

11 changes: 11 additions & 0 deletions lib/mobility/core_ext/object.rb
Expand Up @@ -17,3 +17,14 @@ def presence
self if present?
end
end

=begin
Add +blank?+ method to +NilClass+ in case activesupport cannot be loaded.
=end
class NilClass
def blank?
true
end
end

0 comments on commit 39e2459

Please sign in to comment.