Sha256: e5d5d59997ab3a992e3f8d82ff62a13328805795e5f3a7d237f3b93dc5a3570a

Contents?: true

Size: 830 Bytes

Versions: 3

Compression:

Stored size: 830 Bytes

Contents

# :title: NilClass as Emptiness/Nothingness
#
# = Description
# 
# The ideas here is to have nil acts more like
# an empty set than an error catcher.
# So you get responses like
#   
#   nil.include?(:x) # => nil
# 
# rather than an error being raised.
# 
# WARNING! One should be aware that in some rare cases
# incompatabilites may arise when using these methods in
# conjuction with other external libraries.

require 'facet/nil/to_f'
require 'facet/nil/to_h'
require 'facet/nil/length'
require 'facet/nil/empty%3F'
require 'facet/nil/%5B%5D'
require 'facet/nil/include%3F'
require 'facet/nil/size'

# class NilClass
#   def to_f; 0.0; end
#   def to_h; {}; end
#   def size; 0; end
#   def length; 0; end
#   def empty?; true; end
#   def [](*args); nil; end
#   def include?(*args); nil; end
#   #def to_sym; nil; end
# end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-0.7.0 lib/facet/nil-as-emptiness.rb
facets-0.7.1 lib/facet/nil-as-emptiness.rb
facets-0.7.2 lib/facet/nil-as-emptiness.rb