5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/tweetwall.rb', line 5
def self.(, =5)
= String.new
= String.new
= String.new
= Array.new
words = String.new
begin
= Twitter.user_timeline()[0..]
= Twitter.user().profile_image_url
= + '<div id="tweet_wall">'
.each do ||
= .text
words = .split(" ")
words.each do |word|
if word.start_with?("http://") or word.start_with?("https://")
= .gsub(word, '<a href="' + word + '" target="_blank">' + word + '</a>')
end
if word.start_with?("@")
= .gsub(word, '<a href="http://www.twitter.com/#!/' + word.gsub(/\W$/, "").gsub("@", "") + '" target="_blank">' + word + '</a>')
end
end
= + '<div class="tweet_line">'
= + '<a href="http://www.twitter.com/#!/' + + '" target="_blank"><img src="' + + '" alt="" class="tweet_image" /></a> '
= + '<span class="tweet_text">' + + '</span><br />'
= + '</div>'
end
= + '</div>'
rescue
"Unable to fetch tweets."
ensure
= nil
= nil
= nil
= nil
words = nil
end
end
|