Sha256: e13e0f9a1174c2cd909cc0932d96c78728a9cb63e10c9fe88a77fd22d583dd62

Contents?: true

Size: 703 Bytes

Versions: 2

Compression:

Stored size: 703 Bytes

Contents

# encoding: UTF-8

module Quesadilla
  class Extractor
    # Extract hashtags.
    #
    # This module has no public methods.
    module Hashtags
    private

      require 'twitter-text'

      def extract_hashtags
        Twitter::Extractor::extract_hashtags_with_indices(@working_text).each do |entity|
          entity_text = "##{entity[:hashtag]}"
          @entities << {
            type: ENTITY_TYPE_HASHTAG,
            text: entity_text,
            display_text: entity_text,
            indices: entity[:indices],
            hashtag: entity[:hashtag].downcase
          }
          @working_text.sub!(entity_text, REPLACE_TOKEN * entity_text.length)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
quesadilla-0.1.1 lib/quesadilla/extractor/hashtags.rb
quesadilla-0.1.0 lib/quesadilla/extractor/hashtags.rb