Sha256: 95b0ee2ce7cfedbafa9f7ad574ec05cc45ffcb2c4522b26d9e158529b405031e

Contents?: true

Size: 577 Bytes

Versions: 3

Compression:

Stored size: 577 Bytes

Contents

require 'htmlentities'

module Mastodon
  class Status
    alias_method :rcontent, :content

    Decoder = HTMLEntities.new
    
    ##
    # Strips all html tags out of +content+
    #
    # @return [String]
    
    def strip
      Decoder.decode(rcontent
                       .gsub(/(<\/p><p>|<br\s*\/?>)/, "\n")
                       .gsub(/<("[^"]*"|'[^']*'|[^'">])*>/, ''))
    end

    ##
    # Returns whether or not the status is a reblogged status
    #
    # @return [Boolean]
    
    def is_reblog?
      not @attributes['reblog'].nil?
    end
  end
end
      

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
elephrame-0.5.2 lib/elephrame/util/status.rb
elephrame-0.5.1 lib/elephrame/util/status.rb
elephrame-0.5 lib/elephrame/util/status.rb