Sha256: c8bd7cb1dfae75419745427d6c9c179c04faf7f7f3b4afc54c101898f6dddaf2
Contents?: true
Size: 478 Bytes
Versions: 3
Compression:
Stored size: 478 Bytes
Contents
# HoboSupport-style ._? # ._? calls a method if the receiver is not nil, returns nil # otherwise. require 'singleton' unless nil.respond_to?(:_?) class Object def _?() self end end class NilClass def _?() ModalSupport::SafeNil.instance end end module ModalSupport class SafeNil < ModalSupport::BasicObject include ::Singleton def method_missing(method, *args, &b) return nil end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
modalsupport-0.9.2 | lib/modalsupport/methodcall.rb |
modalsupport-0.9.1 | lib/modalsupport/methodcall.rb |
modalsupport-0.9.0 | lib/modalsupport/methodcall.rb |