Sha256: 0c2b577ad0648f81493630c398af96dd63cfc4fcbee58a5d3ab979773fd0d470

Contents?: true

Size: 392 Bytes

Versions: 27

Compression:

Stored size: 392 Bytes

Contents

module Kernel

  # Tests to see if something has value. An object
  # is considered to have value if it is not nil?
  # and if it responds to #empty?, is not empty.
  #
  #   nil.val?     #=> false
  #   [].val?      #=> false
  #   10.val?      #=> true
  #   [nil].val?   #=> true

  def val?
    return false if nil?
    return false if empty? if respond_to?(:empty?)
    true
  end

end

Version data entries

27 entries across 26 versions & 3 rubygems

Version Path
facets-glimmer-3.2.0 lib/core/facets/kernel/val.rb
facets-3.1.0 lib/core/facets/kernel/val.rb
facets-3.0.0 lib/core/facets/kernel/val.rb
facets-2.9.3 lib/core/facets/kernel/val.rb
facets-2.9.2 lib/core/facets/kernel/val.rb
facets-2.9.2 src/core/facets/kernel/val.rb
facets-2.9.1 lib/core/facets/kernel/val.rb
facets-2.9.0 lib/core/facets/kernel/val.rb
facets-2.9.0.pre.2 lib/core/facets/kernel/val.rb
facets-2.9.0.pre.1 lib/core/facets/kernel/val.rb
facets-2.8.4 lib/core/facets/kernel/val.rb
facets-2.8.3 lib/core/facets/kernel/val.rb
facets-2.8.2 lib/core/facets/kernel/val.rb
facets-2.8.1 lib/core/facets/kernel/val.rb
facets-2.8.0 lib/core/facets/kernel/val.rb
facets-2.7.0 lib/core/facets/kernel/val.rb
facets-2.6.0 lib/core/facets/kernel/val.rb
facets-2.4.0 lib/facets/kernel/val.rb
facets-2.4.1 lib/facets/kernel/val.rb
facets-2.4.2 lib/core/facets/kernel/val.rb