Class: Gistgen::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/gistgen/page.rb

Class Method Summary collapse

Class Method Details

.get_page(url, user_agent = 'gistgen gem request') ⇒ Object

make http request and return the html page



6
7
8
9
10
11
12
13
14
15
# File 'lib/gistgen/page.rb', line 6

def self.get_page(url, user_agent='gistgen gem request')
  begin
    agent = Mechanize.new
    agent.user_agent = user_agent
    agent.get(url)
    agent.page.body
  rescue
    nil
  end
end