No commit activity in last 3 years
No release in over 3 years
A very simple text reformatter. For use in another project, but I suppose could be useful.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.17
>= 0
~> 10.0

Runtime

>= 0
 Project Readme

SimpleTextReformatter

This was a gem I created to be a pure ruby way of very simple reformatting of text, I built it so I could use it in a different project, but feel free to use it wherever you want.

Usage

As I need them I will continue to add more reformat types to this gem, but for now it does an extremely simple phone number reformatting. To use this you just need to call:

SimpleTextReformatter.format_as_phone_number('1234567890')

This follows a few basic rules:

  • The Phone Number will reformat to (123) 456-7890
  • If a region code (really just '1' for now) is passed in it will get chopped off: "11234567890" => "(123) 456-7890"
  • Any additional numbers passed after will be included as an extension: "12345678901234" => "(123) 456-7890 x1234"
  • Any nondigits passed in will be excluded