No commit activity in last 3 years
No release in over 3 years
Syntax sugar for function composite
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

 Project Readme

Function::Composite

This gem provides a syntax sugar for Symbol with Proc#<< and Proc#>>.

Installation

Add this line to your application's Gemfile:

gem 'function-composite'

And then execute:

$ bundle

Or install it yourself as:

$ gem install function-composite

Usage

require 'function-composite'
using Function::Composite

p %w{72 101 108 108 111}.map(&:to_i >> :chr) #=> ["H", "e", "l", "l", "o"]

p %w{72 101 108 108 111}.map(&proc { |s| s.to_i } >> :chr) #=> ["H", "e", "l", "l", "o"]

h = { Alice: 30, Bob: 60, Cris: 90 }
p %w{Alice Bob Cris}.map(&(:to_sym >> h)) #=> [30, 60, 90]

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nobu/function-composite.