Sha256: 611a16e3b5c761e5d8642d19f75d9e69799a739ad3aad4abc20f31d0297d1a99
Contents?: true
Size: 849 Bytes
Versions: 21
Compression:
Stored size: 849 Bytes
Contents
# :title: NilClass as Emptiness/Nothingness # # The ideas here is to have nil act more like # an empty set than an error catcher. # So you get responses like # # nil.include?(:x) # => nil # # instead of 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 libraries. require 'facet/nilclass/to_f' require 'facet/nilclass/to_h' require 'facet/nilclass/op_fetch' require 'facet/nilclass/include' require 'facet/nilclass/empty' require 'facet/nilclass/size' #require 'facet/nilclass/length' # Effectively, the following is what happens: # # 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 # end
Version data entries
21 entries across 21 versions & 1 rubygems