Class: Boxcars::URLText
Overview
A Boxcar that reads text from a URL.
Constant Summary collapse
- DESC =
the description of this boxcar
"useful when you want to get text from a URL."
Instance Attribute Summary
Attributes inherited from Boxcar
#description, #name, #parameters, #return_direct
Instance Method Summary collapse
-
#initialize(name: "FetchURL", description: DESC) ⇒ URLText
constructor
implements a boxcar that uses the Google SerpAPI to get answers to questions.
-
#run(url) ⇒ String
Get text from a url.
Methods inherited from Boxcar
#apply, assi, #call, #conduct, hist, #input_keys, #load, #output_keys, #save, #schema, syst, user, #validate_inputs, #validate_outputs
Constructor Details
Instance Method Details
#run(url) ⇒ String
Get text from a url.
19 20 21 22 |
# File 'lib/boxcars/boxcar/url_text.rb', line 19 def run(url) url = URI.parse(url) do_encoding(get_answer(url)) end |