Skip to content

Instantly share code, notes, and snippets.

@gouf
Created December 8, 2018 17:23
Show Gist options
  • Save gouf/252f118f2940568f98b86222fd8b7f8a to your computer and use it in GitHub Desktop.
Save gouf/252f118f2940568f98b86222fd8b7f8a to your computer and use it in GitHub Desktop.
処理順序がだいじなコードに yield_self を適用する (Ruby 2.5)
# Ref: https://github.com/gouf/scholar_ps/blob/7b4b4bbe79197cbb2683af9cae95ada7e5418c46/ScholarPs/scraper/scraper.rb#L14
def process!
html =
@watir.yield_self(&method(:login!))
.yield_self(&method(:loan_id_confirm!))
.yield_self(&method(:findout_loan_detail!))
.yield_self(&:html)
detail_page = Nokogiri::HTML(html)
convert_to_hash_from_detail_page(detail_page)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment