Class: Embedit::Twitter
- Inherits:
-
Object
- Object
- Embedit::Twitter
- Defined in:
- lib/embedit/providers/twitter.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #html(options = {}) ⇒ Object
-
#initialize(url) ⇒ Twitter
constructor
A new instance of Twitter.
- #status_id ⇒ Object
Constructor Details
#initialize(url) ⇒ Twitter
7 8 9 10 |
# File 'lib/embedit/providers/twitter.rb', line 7 def initialize(url) @format = 'photo' @url = url end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
5 6 7 |
# File 'lib/embedit/providers/twitter.rb', line 5 def format @format end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/embedit/providers/twitter.rb', line 5 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/embedit/providers/twitter.rb', line 5 def url @url end |
Class Method Details
.match(url) ⇒ Object
25 26 27 |
# File 'lib/embedit/providers/twitter.rb', line 25 def self.match(url) url.match(/twitter\.com\/(\S+)\/statuses\/(\d+)/) end |
Instance Method Details
#html(options = {}) ⇒ Object
12 13 14 15 |
# File 'lib/embedit/providers/twitter.rb', line 12 def html( = {}) attributes = .collect {|k,v| "#{k}=\"#{v}\" "}.join(" ") %{<img src="http://twictur.es/i/#{status_id}.gif" #{attributes} />} end |
#status_id ⇒ Object
17 18 19 |
# File 'lib/embedit/providers/twitter.rb', line 17 def status_id @status_id ||= url[/twitter\.com\/(\S+)\/statuses\/(\d+)/,2] end |