Sha256: 893f771abb18802603d53a215e326de270f2c5fe9e89c126936d5d310d30b5c5

Contents?: true

Size: 346 Bytes

Versions: 6

Compression:

Stored size: 346 Bytes

Contents

module RubyHackernews

  class TimeInfoParser

    def initialize(time_element)
      @element = time_element
    end

    def parse
      if @element
        value           = @element.text.strip.split[0].to_i
        unit_of_measure = @element.text.strip.split[1]
      end
      return TimeInfo.new(value, unit_of_measure)
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-hackernews-1.3.6 lib/ruby-hackernews/services/parsers/time_info_parser.rb
ruby-hackernews-1.3.5 lib/ruby-hackernews/services/parsers/time_info_parser.rb
ruby-hackernews-1.3.3 lib/ruby-hackernews/services/parsers/time_info_parser.rb
ruby-hackernews-1.3.2 lib/ruby-hackernews/services/parsers/time_info_parser.rb
ruby-hackernews-1.3.1 lib/ruby-hackernews/services/parsers/time_info_parser.rb
ruby-hackernews-1.3.0 lib/ruby-hackernews/services/parsers/time_info_parser.rb