class App

Public Instance Methods

command() click to toggle source
# File bin/ruby_search_engine.rb, line 18
def command
        query = ARGV.join(" ")
        search_engine = SearchEngine.new
        
        begin
                results = search_engine.search(query, :url, pages: @options[:pages])
        rescue Exception => e
                puts e
        end
        
        puts results
end
define_command_option_parsing() click to toggle source
# File bin/ruby_search_engine.rb, line 12
def define_command_option_parsing
        @opt_parser.on('-p', '--pages RANGE', Integer, 'what pages you want') do |pages|
                @options[:pages] = pages
        end
end
initialize_command_options() click to toggle source
# File bin/ruby_search_engine.rb, line 9
def initialize_command_options
        @options = {:pages => 1}
end