Created
October 24, 2016 11:50
-
-
Save naoto/72d48c7205e1ef11193f4e2c661bb15d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode:ruby; coding:utf-8 -*- | |
module Atig | |
module IFilter | |
module Media | |
def self.call(status) | |
media_urls = [] | |
if status.extended_entities && status.extended_entities.media | |
status.extended_entities.media.each do |media| | |
media_urls << media.media_url | |
end | |
elsif status.entities.media | |
status.entities.media.each do |media| | |
media_urls << media.media_url | |
end | |
end | |
status.merge text: "#{status.text} #{media_urls.join(' ')}" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment