Sha256: 188da9e77e74bc973fe235ba50a971ba04ce576f7d704a7b23f717682a231946

Contents?: true

Size: 1.28 KB

Versions: 6

Compression:

Stored size: 1.28 KB

Contents

# HoboSupport

HoboSupport is a mixed bag of core ruby extensions that have been extracted from the [Hobo][] project

[Hobo]: http://hobocentral.net

    >> require 'hobosupport'
    >> HoboSupport::VERSION
    => "0.7.5"

## Contents

 * [Enumerable](/hobosupport/hobosupport/enumerable/)
 * [Hash](/hobosupport/hobosupport/hash/)
 * [Implies](/hobosupport/hobosupport/implies/)
 * [Metaid](/hobosupport/hobosupport/metaid/)
 * [Methodphitamine](/hobosupport/hobosupport/methodphitamine)
 * [Module](/hobosupport/hobosupport/module)

## Object extensions

### `Object#is_a?`

Extended to allow multiple types to be checked in one go

    >> "foo".is_a?(String, Symbol)
    => true
    >> :foo.is_a?(String, Symbol)
    => true
    >> 1.is_a?(String, Symbol)
    => false

Still works the old way

    >> "foo".is_a?(String)
    => true
    >> :foo.is_a?(String)
    => 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

6 entries across 6 versions & 1 rubygems

Version Path
hobosupport-0.8 test/hobosupport.rdoctest
hobosupport-0.8.1 test/hobosupport.rdoctest
hobosupport-0.8.2 test/hobosupport.rdoctest
hobosupport-0.8.3 test/hobosupport.rdoctest
hobosupport-0.8.4 test/hobosupport.rdoctest
hobosupport-0.8.5 test/hobosupport.rdoctest