Skip to content

Instantly share code, notes, and snippets.

@pikesley
Forked from pezholio/WAT.rb
Created June 14, 2013 08:24
Show Gist options
  • Save pikesley/5780337 to your computer and use it in GitHub Desktop.
Save pikesley/5780337 to your computer and use it in GitHub Desktop.

Revisions

  1. Sam Pikesley revised this gist Jun 14, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions WAT.rb
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@

    uri = "http://data.gov.uk/dataset/water-framework-directive-lake-waterbodies-wfs"

    rdf = nil

    doc = Nokogiri::HTML(open(uri))

    doc.search('link[rel=alternate]').each do |e|
  2. @pezholio pezholio revised this gist Jun 14, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions WAT.rb
    Original file line number Diff line number Diff line change
    @@ -7,12 +7,12 @@

    doc.search('link[rel=alternate]').each do |e|
    if e[:type] == "application/rdf+xml"
    puts "I'm true!"
    puts "rdf should be #{e[:href]}"
    rdf = e[:href]
    end
    end

    # I'm true!
    # rdf should be http://data.gov.uk/dataset/water-framework-directive-lake-waterbodies-wfs.rdf

    # > rdf
    # NameError: undefined local variable or method `rdf' for main:Object
  3. @pezholio pezholio revised this gist Jun 14, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions WAT.rb
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,8 @@
    end
    end

    # I'm true!

    # > rdf
    # NameError: undefined local variable or method `rdf' for main:Object

  4. @pezholio pezholio revised this gist Jun 14, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions WAT.rb
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,7 @@

    doc.search('link[rel=alternate]').each do |e|
    if e[:type] == "application/rdf+xml"
    puts "I'm true!"
    rdf = e[:href]
    end
    end
  5. @pezholio pezholio created this gist Jun 14, 2013.
    22 changes: 22 additions & 0 deletions WAT.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    require 'nokogiri'
    require 'open-uri'

    uri = "http://data.gov.uk/dataset/water-framework-directive-lake-waterbodies-wfs"

    doc = Nokogiri::HTML(open(uri))

    doc.search('link[rel=alternate]').each do |e|
    if e[:type] == "application/rdf+xml"
    rdf = e[:href]
    end
    end

    # > rdf
    # NameError: undefined local variable or method `rdf' for main:Object

    rdf = "foo"

    # > rdf
    # => "foo"

    # WAT