Class: Google_search_cmdline::Result
- Inherits:
-
Object
- Object
- Google_search_cmdline::Result
- Defined in:
- lib/google_search_cmdline_result.rb
Overview
This class represents the results when executing Google_search_cmd#search, which is given by the enumerator.
Instance Method Summary collapse
-
#initialize(args) ⇒ Result
constructor
A new instance of Result.
-
#title ⇒ Object
Returns the title of the result.
-
#url ⇒ Object
Returns the URL of the result.
Constructor Details
#initialize(args) ⇒ Result
Returns a new instance of Result.
3 4 5 6 7 8 |
# File 'lib/google_search_cmdline_result.rb', line 3 def initialize(args) @args = args raise "Invalid URL: '#{@args[:url]}'." if @args[:url].to_s.strip.empty? raise "Invalid title: '#{@args[:title]}'." if @args[:title].to_s.strip.empty? end |
Instance Method Details
#title ⇒ Object
Returns the title of the result.
11 12 13 |
# File 'lib/google_search_cmdline_result.rb', line 11 def title return @args[:title] end |
#url ⇒ Object
Returns the URL of the result.
16 17 18 |
# File 'lib/google_search_cmdline_result.rb', line 16 def url return @args[:url] end |