Class: Lmgtfy::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/lmgtfy/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRunner

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

#queryObject (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_urlObject



13
14
15
# File 'lib/lmgtfy/runner.rb', line 13

def generate_lmgtfy_url
  "http://lmgtfy.com/?#{@query}"
end

#generate_short_urlObject



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.message
  end
end