Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
This repository has been archived by the owner on Apr 13, 2020. It is now read-only.
/ backport_dig Public archive

🔙 backport_dig is the backport of Hash#dig, Array#dig and OpenStruct#dig in Ruby 2.3 to older Ruby versions.

License

Notifications You must be signed in to change notification settings

koic/backport_dig

Repository files navigation

backport_dig Build Status Gem Version

backport_dig is the backport of Hash#dig, Array#dig and OpenStruct#dig in Ruby 2.3 to older Ruby versions.

The best way is to use Ruby 2.3 or later. Because you can use original dig methods and so on.

Installation

Add these lines to your application's Gemfile:

gem 'backport_dig'

And then execute:

$ bundle

Or install it yourself as:

$ gem install backport_dig

And require it as:

require 'backport_dig'

Synopsis

h = {foo: {bar: {baz: 1}}}
h.dig(:foo, :bar, :baz) #=> 1

a = [[1, [2, 3]]]
a.dig(0, 1, 1) #=> 3

Supported Versions

  • Ruby 2.0
  • Ruby 2.1
  • Ruby 2.2

Ruby 2.3 incompatible

  • Struct#dig is not supported

Contributing

  1. Fork it
  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

License

backport_dig is released under the MIT License.

Get the original codes

Special Thanks

  • Ruby Development Team
  • Pay homage to ruby_dig

About

🔙 backport_dig is the backport of Hash#dig, Array#dig and OpenStruct#dig in Ruby 2.3 to older Ruby versions.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published