Sha256: d57ae4ef6e1d89d93af5042478462545efc3aeb98cf992666a9cfce88f5615d8
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
# HoboSupport HoboSupport is a mixed bag of core ruby extensions that have been extracted from the [Hobo][] project [Hobo]: http://hobocentral.net doctest_require: '../lib/hobosupport' {.hidden} >> HoboSupport::VERSION => "0.8.9" ## Contents * [Enumerable](/manual/hobosupport/enumerable) * [Hash](/manual/hobosupport/hash) * [Implies](/manual/hobosupport/implies) * [Metaid](/manual/hobosupport/metaid) * [Methodphitamine](/manual/hobosupport/methodphitamine) * [Module](/manual/hobosupport/module) ## Object extensions ### `Object#is_one_of?` Like `is_a?` but multiple types to be checked in one go >> "foo".is_one_of?(String, Symbol) => true >> :foo.is_one_of?(String, Symbol) => true >> 1.is_one_of?(String, Symbol) => false ## Method call extensions ### `Object#_?` We have the "." operator to call methods on objects. These extensions introduce two "special dots". "`._?.`" only calls the method if the receiver is not `nil`. >> "foo"._?.length => 3 >> nil._?.length => nil ### `Object#try` "`.try`" only calls the method if the receiver responds to that method. >> "foo".try.length => 3 >> :foo.try.length => nil
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hobosupport-0.8.10 | test/hobosupport.rdoctest |
hobosupport-0.8.9 | test/hobosupport.rdoctest |