Class: RubyHackernews::UserInfoParser

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-hackernews/services/parsers/user_info_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(second_line) ⇒ UserInfoParser

Returns a new instance of UserInfoParser.



5
6
7
# File 'lib/ruby-hackernews/services/parsers/user_info_parser.rb', line 5

def initialize(second_line)
  @second_line = second_line
end

Instance Method Details

#parseObject



9
10
11
12
13
14
15
16
# File 'lib/ruby-hackernews/services/parsers/user_info_parser.rb', line 9

def parse
  return unless user_link

  user_name = user_link.inner_html
  user_page = user_link['href']

  UserInfo.new(user_name, user_page)
end