Sha256: dd8877962d65ad979d1b438f397e5dda236061e1d865d25db44738189238c3d4

Contents?: true

Size: 349 Bytes

Versions: 1

Compression:

Stored size: 349 Bytes

Contents

class Object
  def try(method_name, *args, &block)
    if method_name.nil? || !respond_to?(method_name)
      nil
    else
      public_send(method_name, *args, &block)
    end
  end

  def blank?
    respond_to?(:empty?) ? !!empty? : !self
  end

  def present?
    !blank?
  end
end

class String
  def squish
    strip.gsub(/\s+/, ' ')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nfse_gyn-0.3.0 lib/nfse_gyn/extensions.rb