Last active
November 1, 2017 09:01
-
-
Save tyok/374956d05dad4c77e3e25e3987855193 to your computer and use it in GitHub Desktop.
Ruby method chain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sample_text = "foo bar http://github.com/akitaonrails/chainable_methods foo bar" | |
sample_link = URI.extract(sample_text).first | |
uri = URI.parse(sample_link) | |
response = HTTParty.get(uri) | |
doc = Nokogiri::HTML.parse(response) | |
title = doc.css("H1").text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v = "foo bar http://github.com/akitaonrails/chainable_methods foo bar" | |
v = URI.extract(v).first | |
v = URI.parse(v) | |
v = HTTParty.get(v) | |
v = Nokogiri::HTML.parse(v) | |
v = v.css("H1").text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment