class Justicecz::HtmlParser

Public Class Methods

new(body) click to toggle source
# File lib/justicecz/html_parser.rb, line 3
def initialize(body)
  @body = ::Nokogiri::HTML(body)
  @collection = ::Justicecz::Entities::List.new
end
parse(body) click to toggle source
# File lib/justicecz/html_parser.rb, line 8
def self.parse(body)
  new(body).parse
end

Public Instance Methods

parse() click to toggle source
# File lib/justicecz/html_parser.rb, line 12
def parse
  parse_response
  @collection
end

Private Instance Methods

parse_response() click to toggle source
# File lib/justicecz/html_parser.rb, line 23
def parse_response
  result_collection.each do |result|
    next unless Justicecz::Html::ResultLine.line(result)
    @collection << Justicecz::Html::ResultLine.line(result)
  end
end
result_collection() click to toggle source
# File lib/justicecz/html_parser.rb, line 19
def result_collection
  Justicecz::Html::ResultList.collection(@body)
end