class Bluebird::Partial

Attributes

content[RW]
next_partial[RW]
partial_type[R]
prev_partial[RW]

Public Class Methods

new(content, partial_type) click to toggle source
# File lib/bluebird/partial.rb, line 7
def initialize(content, partial_type)
  @content      = content
  @partial_type = partial_type
end

Public Instance Methods

cashtag?() click to toggle source
# File lib/bluebird/partial.rb, line 48
def cashtag?
  @partial_type.eql?(:cashtag)
end
entity?() click to toggle source
# File lib/bluebird/partial.rb, line 52
def entity?
  !text?
end
first?() click to toggle source
# File lib/bluebird/partial.rb, line 20
def first?
  !prev_partial
end
hashtag?() click to toggle source
# File lib/bluebird/partial.rb, line 44
def hashtag?
  @partial_type.eql?(:hashtag)
end
https?() click to toggle source
# File lib/bluebird/partial.rb, line 66
def https?
  url? && content.start_with?('https://')
end
last?() click to toggle source
# File lib/bluebird/partial.rb, line 24
def last?
  !next_partial
end
length() click to toggle source
# File lib/bluebird/partial.rb, line 12
def length
  if url?
    https? ? Config.short_url_length_https : Config.short_url_length
  else
    content.char_length
  end
end
list?() click to toggle source
# File lib/bluebird/partial.rb, line 36
def list?
  @partial_type.eql?(:list)
end
mention?() click to toggle source
# File lib/bluebird/partial.rb, line 32
def mention?
  @partial_type.eql?(:mention)
end
reply_preventer?() click to toggle source
# File lib/bluebird/partial.rb, line 62
def reply_preventer?
  first? && next_partial && next_partial.mention?
end
separator?() click to toggle source
# File lib/bluebird/partial.rb, line 56
def separator?
  # separates two entities
  # ex: @iekutlu and @mekanio => " and " is a separater
  prev_partial && prev_partial.entity? && next_partial && next_partial.entity?
end
text?() click to toggle source
# File lib/bluebird/partial.rb, line 28
def text?
  @partial_type.eql?(:text)
end
url?() click to toggle source
# File lib/bluebird/partial.rb, line 40
def url?
  @partial_type.eql?(:url)
end