Transproc

Gem Version Build Status Dependency Status Code Climate Test Coverage Inline docs

Functional transformations for Ruby. It's currently used as one of the data mapping backends in Ruby Object Mapper.

Installation

Add this line to your application's Gemfile:

gem 'transproc'

And then execute:

$ bundle

Or install it yourself as:

$ gem install transproc

Usage

require 'transproc/all'

# compose transformation functions
transformation = Transproc(:symbolize_keys) + Transproc(:map_hash, user_name: :name))

# call the function
transformation['user_name' => 'Jane']
# => {:name=>"Jane"}

# or using a helper (no, it's not a good idea to include it here :))
include Transproc::Composer

transformation = compose do |fns|
  fns << t(:symbolize_keys) << t(:map_hash, user_name: :name)
end

transformation['user_name' => 'Jane']
# => {:name=>"Jane"}

Credits

This project is inspired by the work of following people:

Contributing

  1. Fork it ( https://github.com/solnic/transproc/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