Class: Lmgtfy::Runner
- Inherits:
-
Object
- Object
- Lmgtfy::Runner
- Defined in:
- lib/lmgtfy/runner.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #generate_lmgtfy_url ⇒ Object
- #generate_short_url ⇒ Object
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize ⇒ Runner
Returns a new instance of Runner.
9 10 11 |
# File 'lib/lmgtfy/runner.rb', line 9 def initialize @query = URI.encode_www_form([ ["q", ARGV.join(" ")] ]) end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
7 8 9 |
# File 'lib/lmgtfy/runner.rb', line 7 def query @query end |
Instance Method Details
#generate_lmgtfy_url ⇒ Object
13 14 15 |
# File 'lib/lmgtfy/runner.rb', line 13 def generate_lmgtfy_url "http://lmgtfy.com/?#{@query}" end |
#generate_short_url ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/lmgtfy/runner.rb', line 17 def generate_short_url begin get_shortened_url_from_is_gd rescue Exception => ex ex. end end |