Class: SirTrevorRails::Blocks::TweetBlock
Constant Summary
SirTrevorRails::Block::DEFAULT_FORMAT
Instance Attribute Summary
#parent, #type
Instance Method Summary
collapse
#as_json, custom_block_types, #format, from_hash, #initialize, #to_partial_path
Instance Method Details
#at_name ⇒ Object
24
25
26
|
# File 'lib/sir_trevor_rails/blocks/tweet_block.rb', line 24
def at_name
"@" << screen_name
end
|
#profile_image_url ⇒ Object
28
29
30
31
32
33
|
# File 'lib/sir_trevor_rails/blocks/tweet_block.rb', line 28
def profile_image_url
"//" << self.user[:profile_image_url].split("://")[1]
end
|
#profile_url ⇒ Object
16
17
18
|
# File 'lib/sir_trevor_rails/blocks/tweet_block.rb', line 16
def profile_url
"//twitter.com/" << self.user[:screen_name]
end
|
#render_tweet_body ⇒ Object
9
10
11
12
13
14
|
# File 'lib/sir_trevor_rails/blocks/tweet_block.rb', line 9
def render_tweet_body
sanitize Twitter::Autolink.auto_link(
self.text,
url_entities: (self.entities.values_at(:urls, :media).flatten.compact.uniq rescue nil)
), tags: %w{a span}, attributes: %w{class href rel target}
end
|
#screen_name ⇒ Object
20
21
22
|
# File 'lib/sir_trevor_rails/blocks/tweet_block.rb', line 20
def screen_name
self.user[:screen_name]
end
|