Class: OPDS::Support::Link
- Inherits:
-
Array
- Object
- Array
- OPDS::Support::Link
- Includes:
- Logging
- Defined in:
- lib/opds/support/linkset.rb
Overview
A link is actually an array composed as :
[rel, url , title, mimetype, opds:price, opds:currency]
Direct Known Subclasses
Instance Attribute Summary collapse
-
#browser ⇒ OPDS::Support::Browser
Browser to use with this link.
Instance Method Summary collapse
-
#currency ⇒ String
Link opds curreny.
-
#initialize(array, browser = OPDS::Support::Browser.new) ⇒ Link
constructor
A new instance of Link.
- #inspect ⇒ Object
-
#navigate ⇒ AcquisitionFeed, ...
Will go parsing the resource at this url.
-
#price ⇒ String
Link opds price.
-
#rel ⇒ String
Link rel value.
-
#title ⇒ String
Link title.
-
#type ⇒ String
Link mimetype.
-
#url ⇒ String
Link url.
Methods included from Logging
Constructor Details
#initialize(array, browser = OPDS::Support::Browser.new) ⇒ Link
Returns a new instance of Link.
11 12 13 14 15 16 17 |
# File 'lib/opds/support/linkset.rb', line 11 def initialize(array,browser=OPDS::Support::Browser.new) @browser=browser unless browser.current_location.nil? array[1]=URI.join(browser.current_location,array[1]).to_s end super array end |
Instance Attribute Details
#browser ⇒ OPDS::Support::Browser
Returns Browser to use with this link.
9 10 11 |
# File 'lib/opds/support/linkset.rb', line 9 def browser @browser end |
Instance Method Details
#currency ⇒ String
Returns link opds curreny.
57 58 59 |
# File 'lib/opds/support/linkset.rb', line 57 def currency self[5] end |
#inspect ⇒ Object
27 28 29 |
# File 'lib/opds/support/linkset.rb', line 27 def inspect "[#{self.map{|e| (e.is_a?(String) && e.size > 100 ? "#{e[0..98]}...".inspect: e.inspect ) }.join(', ')}]" end |
#navigate ⇒ AcquisitionFeed, ...
Will go parsing the resource at this url. Proxy to Feed.parse_url
23 24 25 |
# File 'lib/opds/support/linkset.rb', line 23 def navigate Feed.parse_url(self[1],browser) end |
#price ⇒ String
Returns link opds price.
52 53 54 |
# File 'lib/opds/support/linkset.rb', line 52 def price self[4] end |
#rel ⇒ String
Returns link rel value.
37 38 39 |
# File 'lib/opds/support/linkset.rb', line 37 def rel self[0] end |
#title ⇒ String
Returns link title.
42 43 44 |
# File 'lib/opds/support/linkset.rb', line 42 def title self[2] end |
#type ⇒ String
Returns link mimetype.
47 48 49 |
# File 'lib/opds/support/linkset.rb', line 47 def type self[3] end |
#url ⇒ String
Returns link url.
32 33 34 |
# File 'lib/opds/support/linkset.rb', line 32 def url self[1] end |