0.0
No commit activity in last 3 years
No release in over 3 years
Simple-ish enumberable-simplifier. Useful for APIs like Twitter, etc If you have a hash or an array or something that quacks like one, you can do stuff example: require 'dot_notation' h = {a: {b: {c: [{d: 'hi'}]}}} h.extend(DotNotation) h.dot('a.b.c.0.d') #=> 'hi' h.dot('a.b.c.foo.bar.bz.whatever.124.whocares') #=> nil
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
>= 0
 Project Readme

DotNotation

Simple-ish enumberable-simplifier. Useful for APIs like Twitter, etc

If you have a hash or an array or something that quacks like one, you can do stuff like this:

  require 'dot_notation'
  h = {a: {b: {c: [{d: 'hi'}]}}}

  h[:a][:b][:c][0][:d] # ugh, what a pain
  #=> 'hi'

  h.extend(DotNotation)
  h.dot('a.b.c.0.d') # yay!
  #=> 'hi'

  h.dot('a.b.c.foo.bar.bz.whatever.124.whocares') # automagic nilchecks
  #=> nil

Installation

Add this line to your application's Gemfile:

gem 'dot_notation'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dot_notation

Contributing

  1. Fork it ( http://github.com//dot_notation/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 new Pull Request