Class: Stylesheet::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/stylesheet/request.rb

Instance Method Summary collapse

Instance Method Details

#get(url) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/stylesheet/request.rb', line 3

def get(url)
  curl = Curl::Easy.perform(url) do |curl| 
    curl.headers["User-Agent"] = user_agent
    curl.follow_location       = true
  end

  curl.body_str

rescue Stylesheet::Error
  raise

# re-raise external library errors in our namespace
rescue => error
  raise Stylesheet::Error.new("#{error.class}: #{error.message}")
end

#user_agentObject



19
20
21
# File 'lib/stylesheet/request.rb', line 19

def user_agent
  "Ruby/Stylesheet Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7"
end