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.
-
#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.
6 7 8 9 |
# File 'lib/bluebird/partial.rb', line 6 def initialize(content, partial_type) @content = content @partial_type = partial_type end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
4 5 6 |
# File 'lib/bluebird/partial.rb', line 4 def content @content end |
#next_partial ⇒ Object
Returns the value of attribute next_partial.
4 5 6 |
# File 'lib/bluebird/partial.rb', line 4 def next_partial @next_partial end |
#prev_partial ⇒ Object
Returns the value of attribute prev_partial.
4 5 6 |
# File 'lib/bluebird/partial.rb', line 4 def prev_partial @prev_partial end |
Instance Method Details
#cashtag? ⇒ Boolean
47 48 49 |
# File 'lib/bluebird/partial.rb', line 47 def cashtag? @partial_type.eql?(:cashtag) end |
#entity? ⇒ Boolean
51 52 53 |
# File 'lib/bluebird/partial.rb', line 51 def entity? !text? end |
#first? ⇒ Boolean
19 20 21 |
# File 'lib/bluebird/partial.rb', line 19 def first? !prev_partial end |
#hashtag? ⇒ Boolean
43 44 45 |
# File 'lib/bluebird/partial.rb', line 43 def hashtag? @partial_type.eql?(:hashtag) end |
#https? ⇒ Boolean
65 66 67 |
# File 'lib/bluebird/partial.rb', line 65 def https? url? && content.start_with?('https://') end |
#last? ⇒ Boolean
23 24 25 |
# File 'lib/bluebird/partial.rb', line 23 def last? !next_partial end |
#length ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/bluebird/partial.rb', line 11 def length if url? https? ? Config.short_url_length_https : Config.short_url_length else content.char_length end end |
#list? ⇒ Boolean
35 36 37 |
# File 'lib/bluebird/partial.rb', line 35 def list? @partial_type.eql?(:list) end |
#mention? ⇒ Boolean
31 32 33 |
# File 'lib/bluebird/partial.rb', line 31 def mention? @partial_type.eql?(:mention) end |
#reply_preventer? ⇒ Boolean
61 62 63 |
# File 'lib/bluebird/partial.rb', line 61 def reply_preventer? first? && next_partial && next_partial.mention? end |
#separator? ⇒ Boolean
55 56 57 58 59 |
# File 'lib/bluebird/partial.rb', line 55 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
27 28 29 |
# File 'lib/bluebird/partial.rb', line 27 def text? @partial_type.eql?(:text) end |
#url? ⇒ Boolean
39 40 41 |
# File 'lib/bluebird/partial.rb', line 39 def url? @partial_type.eql?(:url) end |