Class: Columbus
- Inherits:
-
Object
- Object
- Columbus
- Defined in:
- lib/columbus.rb,
lib/columbus/feed.rb,
lib/columbus/link.rb,
lib/columbus/redirect_follower.rb
Defined Under Namespace
Classes: Feed, Link, RedirectFollower
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #all ⇒ Object
-
#initialize(url) ⇒ Columbus
constructor
A new instance of Columbus.
- #primary ⇒ Object
Constructor Details
#initialize(url) ⇒ Columbus
Returns a new instance of Columbus.
14 15 16 |
# File 'lib/columbus.rb', line 14 def initialize(url) @url = url end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
12 13 14 |
# File 'lib/columbus.rb', line 12 def url @url end |
Instance Method Details
#all ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/columbus.rb', line 28 def all @all ||= begin response = RedirectFollower.new(url).resolve @url = response.url parse_links(response.body).map { |hpricot_link| link_to_feed(hpricot_link) } end end |
#primary ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/columbus.rb', line 18 def primary @primary ||= begin response = RedirectFollower.new(url).resolve @url = response.url if hpricot_link = parse_links(response.body)[0] link_to_feed(hpricot_link) end end end |