Slide 40
Slide 40 text
Arcane Languages?!
class Tweet
def self.recent
tweets = TWITTER_CLIENT.user_timeline(
"JEG2",
exclude_replies: true,
include_rts: false
)
Array(tweets).map { |tweet|
new( id: tweet.id,
url: tweet.url.to_s,
body: tweet.text,
created_at: tweet.created_at,
user_name: tweet.user.screen_name,
avatar_url: tweet.user.profile_image_url )
}
end
include Twitter::Autolink
def initialize(id: , url: , body: , created_at: , user_name: , avatar_url: )
@id = id
@url = url
@body = body
@created_at = created_at
@user_name = user_name
@avatar_url = avatar_url
end
attr_reader :id, :url, :body, :created_at, :user_name, :avatar_url
def linked_body
auto_link( body, link_attribute_block: ->(_, link_attributes) {
link_attributes.merge!(target: "_blank")
} )
end
end