This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require("nokogiri") | |
| require("./url_fetcher") | |
| class HtmlParser | |
| def parse url | |
| html = UrlFetcher.new.fetch url | |
| Nokogiri::HTML(html).css('a').map{|e| parse_url(url, get_href(e)) }.compact | |
| end | |
| def get_href e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Presentation | |
| attr_accessor :title, :presenter | |
| def initialize title, presenter | |
| @title = title | |
| @presenter = presenter | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Presentation | |
| attr_accessor :title, :author, :scores | |
| def initialize title, author | |
| @title = title | |
| @author = author | |
| @scores = [] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Array | |
| def xeach | |
| i = 0 | |
| while i < self.size | |
| yield self[i] | |
| i += 1 | |
| end | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Pres | |
| attr_accessor :what, :who | |
| def initialize what, who, cat = "?" | |
| @what = what | |
| @who = who | |
| @cat = cat | |
| @scores = [] |