Sha256: eab26fb87b3f4f5128c68ac95449701fc83feaa8499751af148173b87244992a
Contents?: true
Size: 484 Bytes
Versions: 5
Compression:
Stored size: 484 Bytes
Contents
class VotingInfoParser def initialize(voting_element, score_element) @voting_element = voting_element @score_element = score_element end def parse upvote = @voting_element[0]['href'] if @voting_element[0] downvote = @voting_element[1]['href'] if @voting_element[1] points_element = @score_element.search("span")[0] score = points_element.inner_html.split[0].to_i if points_element return VotingInfo.new(score, upvote, downvote) end end
Version data entries
5 entries across 5 versions & 1 rubygems