Class: Microby::HFeed

Inherits:
Object
  • Object
show all
Defined in:
lib/microby/h_feed.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ HFeed

Returns a new instance of HFeed.



4
5
6
7
# File 'lib/microby/h_feed.rb', line 4

def initialize(html)
  @entries = []
  parse_html(html)
end

Instance Attribute Details

#entriesObject

Returns the value of attribute entries.



3
4
5
# File 'lib/microby/h_feed.rb', line 3

def entries
  @entries
end

Instance Method Details

#parse_html(html) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/microby/h_feed.rb', line 9

def parse_html(html)
  doc = Nokogiri::HTML(open html)
  doc.css(".h-entry").each do |mf_entry|
    entry = HEntry.new(mf_entry)
    self.entries << entry
  end
end