Cinch::Toolbox
This is just a gem required fro many of my plugins, it facilitates a variety of mundane operations.
- URL Shortening / Expansion.
- URL Title Scraping.
- Webpage DOM element retrieval (via xpath or css selectors).
- Output truncation for sanity proof channel output.
Note: There is a small monkey patch to OpenURI contained in this gem. It allows for redirection
on urls that require https. For example, normally if you link to an http://github.com/...
url on
GitHub you will get redirected to the https version of that link, and OpenURI will lose it's shit.
Note that this only honors redirection requests from HTTP => HTTPS and not HTTPS => HTTP.
Installation
Add this line to your application's Gemfile:
gem 'cinch/toolbox'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cinch-toolbox
Contributing
- Fork it
- 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 new Pull Request
Changelog
- 1.0.3
- [Enhancement] Added
Toolbox.sent_via_private_message?
for restricting commands to use in channel only
- [Enhancement] Added
- 1.0.2
- [Enhancement] Reorged the file layout a bit to be more canonical (
require cinch/toolbox
now instead ofrequire cinch-toolbox
. - [Enhancement] Added support for retrieving the full contents of a html element by passing
:css_full
or:xpath_full
to theCinch::Toolbox.get_html_element
method.
- [Enhancement] Reorged the file layout a bit to be more canonical (
- 1.0.1
- [Refactor] Updated how
time_format
functions.
- [Refactor] Updated how
- 1.0.0 (
- Added tests!
- Added docs!
- Cleaned up code in
Toolbox.get_html_element
to be more error resistant - Cleaned up code in
Toolbox.time_format
to be more concise.