Class: UrlParser
- Inherits:
-
Object
- Object
- UrlParser
- Defined in:
- lib/parser/url_parser.rb
Instance Method Summary collapse
-
#initialize(url) ⇒ UrlParser
constructor
A new instance of UrlParser.
- #parse ⇒ Object
Constructor Details
#initialize(url) ⇒ UrlParser
Returns a new instance of UrlParser.
6 7 8 |
# File 'lib/parser/url_parser.rb', line 6 def initialize(url) @url = url end |
Instance Method Details
#parse ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/parser/url_parser.rb', line 10 def parse content = "" open(@url) do |file| file.each_line do |line| content << line end end JSON.parse(content[16..-1])["payload"] end |