Class: Bluebird::Partial
- Inherits:
-
Object
- Object
- Bluebird::Partial
- Defined in:
- lib/bluebird/partial.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#next_partial ⇒ Object
Returns the value of attribute next_partial.
-
#partial_type ⇒ Object
readonly
Returns the value of attribute partial_type.
-
#prev_partial ⇒ Object
Returns the value of attribute prev_partial.
Instance Method Summary collapse
- #cashtag? ⇒ Boolean
- #entity? ⇒ Boolean
- #first? ⇒ Boolean
- #hashtag? ⇒ Boolean
- #https? ⇒ Boolean
-
#initialize(content, partial_type) ⇒ Partial
constructor
A new instance of Partial.
- #last? ⇒ Boolean
- #length ⇒ Object
- #list? ⇒ Boolean
- #mention? ⇒ Boolean
- #reply_preventer? ⇒ Boolean
- #separator? ⇒ Boolean
- #text? ⇒ Boolean
- #url? ⇒ Boolean
Constructor Details
#initialize(content, partial_type) ⇒ Partial
Returns a new instance of Partial.
7 8 9 10 |
# File 'lib/bluebird/partial.rb', line 7 def initialize(content, partial_type) @content = content @partial_type = partial_type end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
5 6 7 |
# File 'lib/bluebird/partial.rb', line 5 def content @content end |
#next_partial ⇒ Object
Returns the value of attribute next_partial.
5 6 7 |
# File 'lib/bluebird/partial.rb', line 5 def next_partial @next_partial end |
#partial_type ⇒ Object (readonly)
Returns the value of attribute partial_type.
4 5 6 |
# File 'lib/bluebird/partial.rb', line 4 def partial_type @partial_type end |
#prev_partial ⇒ Object
Returns the value of attribute prev_partial.
5 6 7 |
# File 'lib/bluebird/partial.rb', line 5 def prev_partial @prev_partial end |
Instance Method Details
#cashtag? ⇒ Boolean
48 49 50 |
# File 'lib/bluebird/partial.rb', line 48 def cashtag? @partial_type.eql?(:cashtag) end |
#entity? ⇒ Boolean
52 53 54 |
# File 'lib/bluebird/partial.rb', line 52 def entity? !text? end |
#first? ⇒ Boolean
20 21 22 |
# File 'lib/bluebird/partial.rb', line 20 def first? !prev_partial end |
#hashtag? ⇒ Boolean
44 45 46 |
# File 'lib/bluebird/partial.rb', line 44 def hashtag? @partial_type.eql?(:hashtag) end |
#https? ⇒ Boolean
66 67 68 |
# File 'lib/bluebird/partial.rb', line 66 def https? url? && content.start_with?('https://') end |
#last? ⇒ Boolean
24 25 26 |
# File 'lib/bluebird/partial.rb', line 24 def last? !next_partial end |
#length ⇒ Object
12 13 14 15 16 17 18 |
# 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? ⇒ Boolean
36 37 38 |
# File 'lib/bluebird/partial.rb', line 36 def list? @partial_type.eql?(:list) end |
#mention? ⇒ Boolean
32 33 34 |
# File 'lib/bluebird/partial.rb', line 32 def mention? @partial_type.eql?(:mention) end |
#reply_preventer? ⇒ Boolean
62 63 64 |
# File 'lib/bluebird/partial.rb', line 62 def reply_preventer? first? && next_partial && next_partial.mention? end |
#separator? ⇒ Boolean
56 57 58 59 60 |
# 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? ⇒ Boolean
28 29 30 |
# File 'lib/bluebird/partial.rb', line 28 def text? @partial_type.eql?(:text) end |
#url? ⇒ Boolean
40 41 42 |
# File 'lib/bluebird/partial.rb', line 40 def url? @partial_type.eql?(:url) end |