No commit activity in last 3 years
No release in over 3 years
A library to create text processing pipelines.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.5
>= 0
 Project Readme

StringProcessing

This is a tiny little gem that tries to add a little structure in moments where you are doing extensive text transformations.

Ruby has amazing string processing abilities built in but in circumstances were many transformations are required its common to see long chains of gsubs/splits/joins.

The goal here is to avoid that an replace it with something a little more readable and structured.

Installation

Add this line to your application's Gemfile:

gem 'string_processing'

And then execute:

$ bundle

Or install it yourself as:

$ gem install string_processing

Usage

To use StringProcessing you first define a pipeline by calling Pipeline.define. This will return a class which will do the processing when you call the process method.

FooPipeline = StringProcessing::Pipeline.define do
  using proc{|x| x.map{|n| n.split('/')} }
  using proc{|x| x.map(&:downcase) }
end

FooPipeline.process "HTML/CSS"
=> ["html", "css"]

The processing pipeline can consist of anything that responds to #call and both accepts and returns an array.

Contributing

  1. Fork it ( http://github.com/sleepycat/string_processing/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 new Pull Request