Sha256: 57c0b0dda7964c8b7cc71698f62753f79785361f5207d14f51a12c0447baf59c

Contents?: true

Size: 1.19 KB

Versions: 1

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.9.0"

## 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

1 entries across 1 versions & 1 rubygems

Version Path
hobosupport-0.9.0 test/hobosupport.rdoctest