Sha256: cc66c033598bc05409f2de77aed9894bf8138b7dac80add955ddc49a14b4207b

Contents?: true

Size: 408 Bytes

Versions: 14

Compression:

Stored size: 408 Bytes

Contents

=begin

Add +blank?+, +present?+ and +presence+ methods to +Object+ class if
activesupport cannot be loaded.

=end
class Object
  def blank?
    respond_to?(:empty?) ? !!empty? : !self
  end

  def present?
    !blank?
  end

  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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mobility-0.1.20 lib/mobility/core_ext/object.rb
mobility-0.1.19 lib/mobility/core_ext/object.rb
mobility-0.1.18 lib/mobility/core_ext/object.rb
mobility-0.1.17 lib/mobility/core_ext/object.rb
mobility-0.1.16 lib/mobility/core_ext/object.rb
mobility-0.1.15 lib/mobility/core_ext/object.rb
mobility-0.1.14 lib/mobility/core_ext/object.rb
mobility-0.1.13 lib/mobility/core_ext/object.rb
mobility-0.1.12 lib/mobility/core_ext/object.rb
mobility-0.1.11 lib/mobility/core_ext/object.rb
mobility-0.1.10 lib/mobility/core_ext/object.rb
mobility-0.1.7 lib/mobility/core_ext/object.rb
mobility-0.1.6 lib/mobility/core_ext/object.rb
mobility-0.1.5 lib/mobility/core_ext/object.rb