Created
February 17, 2014 15:37
-
-
Save mcoms/9052798 to your computer and use it in GitHub Desktop.
Ruby contractor daily rates (London)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'open-uri' | |
doc = Nokogiri::HTML.parse open('http://www.itjobswatch.co.uk/contracts/london/ruby.do') | |
# Inside London... | |
cells = doc.css('table.summary>tr').find {|tr| tr.css('>td').text =~ /Average daily rate/ }.css 'td' | |
daily_rates = { three_months: cells[1].text, last_year: cells[2].text, two_years_ago: cells[3].text } | |
# => {:three_months=>"£425", :last_year=>"£400", :two_years_ago=>"£375"} | |
# Outside London... | |
cells = doc.css('table.summary>tr').find {|tr| tr.css('>td').text =~ /UK excluding London average daily rate/ }.css 'td' | |
daily_rates = { three_months: cells[1].text, last_year: cells[2].text, two_years_ago: cells[3].text } | |
# => {:three_months=>"£325", :last_year=>"£325", :two_years_ago=>"£400"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment