HashFilter
Gem | Source | Documentation
A simple hash filter.
Installation
Add this line to your application's Gemfile:
gem 'hash_filter'
And then execute:
$ bundle
Or install it yourself as:
$ gem install hash_filter
Usage
remove_images = HashFilter.new do
delete /\.jpg$/
delete /\.png$/
delete /\.gif$/
end
rename_html = HashFilter.new do
rename /(.*?)\.htm$/, '\1.html'
end
filter = HashFilter.new do
inject remove_images
inject rename_html
end
hash = {
"image.jpg" => "/path/to/image.jpg",
"image.png" => "/path/to/image.png",
"page.htm" => "/path/to/page.html"
}
p filter.apply hash
# {
# "page.html" => "/path/to/page.html"
# }
Contributing
- Fork it ( https://github.com/neopoly/hash_filter/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Releasing
- Edit version.rb
- Add changes to CHANGELOG.md
rake release