Skip to content
/ excise Public

A Ruby port of laktek's extract-values: "This is a simple helper to extract values from a string based on a pattern."

License

Notifications You must be signed in to change notification settings

ezkl/excise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Excise Build Status Code Climate

This is a simple helper to extract values from a string based on a pattern.

A Ruby port of laktek's extract-values.

Installation

Add this line to your application's Gemfile:

gem 'excise'

And then execute:

$ bundle

Or install it yourself as:

$ gem install excise

Usage

require 'excise'

# Basic use
pattern_text = 'About {result_count} results'
Excise(pattern_text, 'About 49,000 results') #=> {:result_count=>"49,000"}

# Memoize pattern for performance improvement
pattern = Excise.new(pattern_text)
pattern.parse 'About 49,000,000 results' #=> {:result_count=>"49,000,000"}
pattern.parse 'About 1,000 results' #=> {:result_count=>"1,000"}

Contributing

  1. Fork it
  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

About

A Ruby port of laktek's extract-values: "This is a simple helper to extract values from a string based on a pattern."

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages