Sha256: bea34320a3d2a6b9fd19634b439baa73109209306355c8045e410edddac78b28

Contents?: true

Size: 435 Bytes

Versions: 7

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 == to_s.reverse
  end

end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
nobiru-1.0.0 lib/nobiru/extensions/object_extension.rb
nobiru-0.0.1 lib/nobiru/extensions/object_extension.rb
flash_extensions-3.2.3 lib/flash_extensions/extensions/object_extension.rb
flash_extensions-3.2.2 lib/flash_extensions/extensions/object_extension.rb
flash_extensions-3.2.1 lib/flash_extensions/extensions/object_extension.rb
flash_extensions-3.2.0 lib/flash_extensions/extensions/object_extension.rb
flash_extensions-3.1.1 lib/flash_extensions/extensions/object_extension.rb