Sha256: 02ad661c08abd5f34b97539f10a4410e5b3e067ff4c1d4a4a6d5c5bed3777d6e
Contents?: true
Size: 773 Bytes
Versions: 7
Compression:
Stored size: 773 Bytes
Contents
class NilClass # Nil#status makes it possible to pass messages # through a "failure" chain. # # def foo # return nil.status("failed foo!") # end # # result = foo # if result.nil? # result.status? #=> true # result.status #=> "failed foo!" # end # # CREDIT: Trans def status(status=nil) if status @status = status self else @status end end # Check status. # # def foo # return nil.status("failed foo!") # end # # result = foo # if result.nil? # result.status? #=> true # result.status #=> "failed foo!" # end # # CREDIT: Trans def status? return unless @status return false if @status.empty? return true end end
Version data entries
7 entries across 7 versions & 2 rubygems