Sha256: 7e358b6bb19ba8091149adc9bf7547b7c62871e75513a3ebb9382e48fc08f246

Contents?: true

Size: 476 Bytes

Versions: 10

Compression:

Stored size: 476 Bytes

Contents

# util.rb is inspired by ActiveSupport

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

class NilClass
  def blank?
    true
  end
end

class FalseClass
  def blank?
    true
  end
end

class TrueClass
  def blank?
    false
  end
end

class Array
  alias_method :blank?, :empty?
end

class Hash
  alias_method :blank?, :empty?
end

class String
  def blank?
    self !~ /[^[:space:]]/
  end
end

class Numeric
  def blank?
    false
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rmake-notation-0.0.16 lib/rmake-util.rb
rmake-notation-0.0.15 lib/rmake-util.rb
rmake-notation-0.0.14 lib/rmake-util.rb
rmake-notation-0.0.13 lib/rmake-util.rb
rmake-notation-0.0.12 lib/rmake-util.rb
rmake-notation-0.0.11 lib/rmake-util.rb
rmake-notation-0.0.10 lib/rmake-util.rb
rmake-notation-0.0.9 lib/rmake-util.rb
rmake-notation-0.0.8 lib/rmake-util.rb
rmake-notation-0.0.7 lib/rmake-util.rb