No commit activity in last 3 years
No release in over 3 years
the library behind the scenes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Build Status

Ninja

the library behind the scenes

Installation

Add this line to your application's Gemfile:

gem 'ninja-collection'

And then execute:

$ bundle install

Usage

Ninja::Hash

require 'ninja/hash'

h = Ninja::Hash.new(hoge: 1, foo: 2)
h.hoge # => 1
h.foo  # => 2
h.piyo # => nil

h.bar = 100
h.bar # => 100

h = {hoge: 1, foo: 2}.to_ninja_hash
h.hoge # => 1
h.foo  # => 2

h_ninja = {hoge: 1, foo: 2}.ninja
h_ninja.hoge # => 1
h_ninja.foo  # => 2

h = {hoge: 1, foo: { bar: 2 }}.ninja
h.foo.bar # => 2

# default value
h.get(:piyo) { 1 + 2 } # => 3
h.get(:piyo)           # => nil

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