Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

IvyApp/hash_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HashGenerator

Build Status

Simple programmatic building of hashes.

Installation

Add this line to your application's Gemfile:

gem 'hash_generator'

And then execute:

bundle

Or install it yourself as:

gem install hash_generator

Usage

Use #store to store primitive values:

require 'hash_generator'

generator = HashGenerator.new
generator.store(:hello, 'world!')
generator.to_h # => {:hello=>"world!"}

Or use #new_object and #store_scope to nest hashes:

require 'hash_generator'

generator = HashGenerator.new
generator.new_object
generator.store(:hello, 'world!')
generator.store_scope(:object)
generator.to_h # => {:object=>{:hello=>"world!"}}

Or use #new_array and #push_scope to push objects into an array:

require 'hash_generator'

generator = HashGenerator.new
generator.new_array
generator.new_object
generator.store(:hello, 'world!')
generator.push_scope
generator.store_scope(:array)
generator.to_h # => {:array=>[{:hello=>"world!"}]}

Contributing

  1. Fork it (https://github.com/IvyApp/hash\_generator/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

About

Simple programmatic building of hashes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages