Class: Q::Search

Inherits:
Command show all
Defined in:
lib/q/commands/search.rb

Instance Attribute Summary

Attributes inherited from Command

#registered_shortcuts

Instance Method Summary collapse

Methods inherited from Command

#help, #usage

Constructor Details

#initialize(url_pattern, usage) ⇒ Search

Returns a new instance of Search.



3
4
5
6
# File 'lib/q/commands/search.rb', line 3

def initialize(url_pattern, usage)
	@url_pattern = url_pattern
	super(usage)
end

Instance Method Details

#execute(shortcut, terms) ⇒ Object



9
10
11
12
13
# File 'lib/q/commands/search.rb', line 9

def execute(shortcut, terms)
	url = @url_pattern % terms.join("+")
	%x{osascript -e 'open location "#{url}"'}
	url
end