class ExceptionOverflow::Message
Public Class Methods
new(q)
click to toggle source
# File lib/exception_overflow/message.rb, line 3 def initialize(q) @q = q end
Public Instance Methods
render()
click to toggle source
# File lib/exception_overflow/message.rb, line 7 def render @q + "\n\n#{links}" end
Private Instance Methods
links()
click to toggle source
# File lib/exception_overflow/message.rb, line 13 def links ExceptionOverflow::StackOverflow.search(q: @q) .parsed_response['items'].map{ |i| template(i['title'], i['link']) } .first(5).join end
template(title, link)
click to toggle source
Formatted link for output:
Which is the best graphical ruby profiler? stackoverflow.com/questions/8448705/which-is-the-best-graphical-ruby-profiler
# File lib/exception_overflow/message.rb, line 24 def template(title, link) "\t\e[1m#{title}\e[22m\n\t#{link}\n\n" end