Sha256: b400633dc0d5f7b7d6b35c5aadd2715d062a69071bf60275f58a66d54312d962

Contents?: true

Size: 889 Bytes

Versions: 2

Compression:

Stored size: 889 Bytes

Contents

module TweetSanitizer
  module TwitterExtension
    refine(Twitter::Tweet) do
      # Sanitize tweet
      # @param use_retweeted_tweet [Boolean] Whether use original retweeted tweet if exists
      # @param expand_url          [Boolean] Whether expand url in tweet (e.g. `t.co` url -> original url)
      # @param remove_media_url    [Boolean] Whether remove media url in tweet
      # @param unescape            [Boolean] Whether unescape in tweet (e.g. `(&gt; &lt;)` -> `(> <)`)
      # @return [String]
      def sanitized_text(use_retweeted_tweet: true, expand_url: true, remove_media_url: true, unescape: true)
        TweetSanitizer.sanitize(
          self,
          use_retweeted_tweet: use_retweeted_tweet,
          expand_url:          expand_url,
          remove_media_url:    remove_media_url,
          unescape:            unescape,
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tweet_sanitizer-0.2.1 lib/tweet_sanitizer/twitter_extension.rb
tweet_sanitizer-0.2.0 lib/tweet_sanitizer/twitter_extension.rb