hashtag_parser

Hashtag parser inspired by https://github.com/tonsser/hashtag-rs/ Given a string, this gem returns an array with an object with `text`, `start` and `end`. Its goal is to match Instagram's parsing of hashtags.


License
MIT
Install
gem install hashtag_parser -v 0.1.0

Documentation

HashtagParser

Build Status

A hashtag parser that brings the behavior of hashtag-rs to ruby and the work of using an Finite State Machine to do the parsing by davidpdrsn

Given a string as "#ruby is #awesome", this gem returns an array with an object with text, start and end for each of the two hashtags in the string.

Its goal is to match Instagram's parsing of hashtags.

Installation

Add this line to your application's Gemfile:

gem 'hashtag_parser'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install hashtag_parser

Usage

hashtags = HashtagParser.parse("#ruby is #awesome")

hashtags is going to be:

[
  {
    text: "ruby",
    start: 0,
    end: 4
  },
  {
    text: "awesome",
    start: 9,
    end: 16
  }
]

Contact

Twitter: @zucaritask

Github: @zucaritask

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

License

The gem is available as open source under the terms of the MIT License.