Class: Embedit::Myspace

Inherits:
Object
  • Object
show all
Defined in:
lib/embedit/providers/myspace.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Myspace

Returns a new instance of Myspace.



7
8
9
10
# File 'lib/embedit/providers/myspace.rb', line 7

def initialize(url)
  @url = url
  @format = 'picture'
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



5
6
7
# File 'lib/embedit/providers/myspace.rb', line 5

def format
  @format
end

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'lib/embedit/providers/myspace.rb', line 5

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/embedit/providers/myspace.rb', line 5

def url
  @url
end

Class Method Details

.match(url) ⇒ Object



24
25
26
# File 'lib/embedit/providers/myspace.rb', line 24

def self.match(url)
  url.match(/viewmorepics\.myspace\.com/)
end

Instance Method Details

#html(size = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/embedit/providers/myspace.rb', line 16

def html(size = {})
  attributes = size.collect {|k,v| "#{k}=\"#{v}\" "}.join(" ")
  puts src = page.at("img#userImage").to_s.slice(/src=.+\.\w+/)
  %{
    <a href="#{@url}"><img src="#{src}" #{attributes}/></a>
  }
end