Skip to content

Commit

Permalink
[#7] Update parse_into method to be bang method and return the object
Browse files Browse the repository at this point in the history
  • Loading branch information
malparty committed Jun 22, 2021
1 parent b2e27c8 commit 9690e54
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/services/google/parser_service.rb
Expand Up @@ -20,14 +20,18 @@ def initialize(html_response:)
@document.css('#footcnt a').add_class('footer-links')
end

def parse_into(keyword)
# Write parsed data directly in the keyword object argument
# and return back the keyword object
def parse_into!(keyword)
keyword.ads_top_count = ads_top_count
keyword.ads_page_count = ads_page_count
keyword.ads_top_url = ads_top_url
keyword.ads_page_url = ads_page_url
keyword.non_ads_result_count = non_ads_result_count
keyword.total_link_count = total_link_count
keyword.html = @html

keyword
end

def ads_top_count
Expand Down

0 comments on commit 9690e54

Please sign in to comment.