Sha256: 1c5d168fb3e9f6470039fb5b725dbc6ea4f9e28533e460942e578d4f782c7289

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

# Brototype

Bro, do you even Ruby?

This is a ruby port of the popular brototype.js library that can be found here:
https://github.com/letsgetrandy/brototype

## Features

You've got a deeply-nested set of objects that may or may not always be there.
We've all seen something like this:

```
if params && params[:model] && params[:model][:id]
    # do something
end
```

We all hate that, don't we?

So what if you could just type:
```
Brototype::Bro.new(params).i_can_haz(:model,:id)
```

Or better yet, how about:
```
Brototype::Bro.new(params).i_dont_always(:model,:id).but_when_i do |id|
  puts id
end
```

Fetch nested properties by string or key:
```
Brototype::Bro.new(:foo => {:bar => 1}).i_can_haz(:foo,:bar)
Brototype::Bro.new('foo' => {'bar' => 1}).i_can_haz('foo','bar')
```

### Handling exceptions
```
Brototype::Bro.new(@anon_class).brace_yourself('throws_error').here_come_the_errors do |e|
  puts 'error ' + e + ' happened.'
end
```

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'brototype'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install brototype

## Rspec is used to run the tests, just do:

```
rake spec
```

## Contributing

1. Fork it ( https://github.com/[my-github-username]/brototype/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
brototype-0.9.4 README.md