Class: Embedit::Ovi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Ovi



10
11
12
13
14
15
16
# File 'lib/embedit/ovi/ovi.rb', line 10

def initialize(url)
  page = Hpricot(open(url))
  @url= url
  work_out_html(page)
  work_out_format(@html)
  @title = page.search("h2.pagetitle").inner_html.strip
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



8
9
10
# File 'lib/embedit/ovi/ovi.rb', line 8

def format
  @format
end

#titleObject (readonly)

Returns the value of attribute title.



8
9
10
# File 'lib/embedit/ovi/ovi.rb', line 8

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



8
9
10
# File 'lib/embedit/ovi/ovi.rb', line 8

def url
  @url
end

Instance Method Details

#html(size = {}) ⇒ Object



18
19
20
21
22
# File 'lib/embedit/ovi/ovi.rb', line 18

def html(size = {})
  @html.gsub!(/height="\d+"/, %{height="#{size[:height]}"}) if size[:height]
  @html.gsub!(/width="\d+"/, %{width="#{size[:width]}"}) if size[:width]
  @html
end