Sha256: 7e55ddb5149b39077e39d5984005b8f04d4897a8ef4eb9004dfa890d1b480124
Contents?: true
Size: 482 Bytes
Versions: 2
Compression:
Stored size: 482 Bytes
Contents
module RubyHackernews class TimeInfoParser def initialize(second_line) @second_line = second_line end def parse return unless time_link value = time_link.text.strip.split[0].to_i unit_of_measure = time_link.text.strip.split[1] TimeInfo.new(value, unit_of_measure) end private def time_link links.find { |link| link.text =~ /\sago/ } end def links @second_line.css('a') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-hackernews-1.4.0 | lib/ruby-hackernews/services/parsers/time_info_parser.rb |
ruby-hackernews-1.3.7 | lib/ruby-hackernews/services/parsers/time_info_parser.rb |