Sha256: cd85c01bed892918c79d7bd10816a5fdaa1edaddd50e8541e419b5d3df62dd86

Contents?: true

Size: 387 Bytes

Versions: 3

Compression:

Stored size: 387 Bytes

Contents

begin
  # Add support for Object#presence:
  require 'active_support/core_ext/object/blank'

rescue LoadError => e
  Object.class_eval do
    unless respond_to?(:present?)
      def present?
        !!presence
      end
    end
    
    unless respond_to?(:presence)
      def presence
        return nil if respond_to?(:empty?) ? empty? : !self
        self
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hungry-0.1.1 lib/support/presence.rb
hungry-0.1.0 lib/support/presence.rb
hungry-0.0.1 lib/support/presence.rb