Sha256: 35d4877b0567e274e416363bcc0df2a943589a09352d81b808459446d1a25c32

Contents?: true

Size: 451 Bytes

Versions: 1

Compression:

Stored size: 451 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?
    !self.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/).nil?
  end

  def palindrome?
    self.to_s.reverse == self.to_s
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flash_extensions-0.0.1 lib/flash_extensions/extensions/object_extension.rb