Class: Umatic::Channel
- Inherits:
-
Object
- Object
- Umatic::Channel
- Defined in:
- lib/channel/channel.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(url) ⇒ Channel
constructor
A new instance of Channel.
- #parse(page) ⇒ Object
- #process ⇒ Object
Constructor Details
#initialize(url) ⇒ Channel
Returns a new instance of Channel.
27 28 29 |
# File 'lib/channel/channel.rb', line 27 def initialize(url) @url = url end |
Class Method Details
.channels ⇒ Object
9 |
# File 'lib/channel/channel.rb', line 9 def self.channels; @@channels; end |
.inherited(subclass) ⇒ Object
11 12 13 14 |
# File 'lib/channel/channel.rb', line 11 def self.inherited(subclass) @@channels ||= [] @@channels << subclass end |
.open(url) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/channel/channel.rb', line 16 def self.open(url) @@channels.each do |c| return c.new(url) if c.supports? url end nil end |
.supports?(url) ⇒ Boolean
23 24 25 |
# File 'lib/channel/channel.rb', line 23 def self.supports? url false end |
Instance Method Details
#parse(page) ⇒ Object
31 32 33 |
# File 'lib/channel/channel.rb', line 31 def parse(page) raise "Parsing not implemented for #{self.class}" end |
#process ⇒ Object
35 36 37 38 |
# File 'lib/channel/channel.rb', line 35 def process page = HTTPClient.instance.get @url parse page end |