Sha256: 3957b49a2d0f210148b0527057004d5418e1fcbca6e970e2b3a5e2cd3aeffbc2

Contents?: true

Size: 435 Bytes

Versions: 4

Compression:

Stored size: 435 Bytes

Contents

class Object

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

  unless method_defined?(:present?)
    def present?
      !blank?
    end
  end

  unless method_defined?(:try)
    def try(method)
      send(method) if respond_to?(method)
    end
  end

  def numeric?
    !to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/).nil?
  end

  def palindrome?
    to_s.reverse == to_s
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flash_extensions-3.1.0 lib/flash_extensions/extensions/object_extension.rb
flash_extensions-3.0.0 lib/flash_extensions/extensions/object_extension.rb
flash_extensions-1.1.0 lib/flash_extensions/extensions/object_extension.rb
flash_extensions-1.0.0 lib/flash_extensions/extensions/object_extension.rb