Sha256: b635d6e4ef47e50bd7af287781f870748f20a410233ec8d347332b72720a725b

Contents?: true

Size: 631 Bytes

Versions: 10

Compression:

Stored size: 631 Bytes

Contents

require 'nokogiri'

module Wagon
  class Page
    attr_reader :connection
    
    def initialize(connection, url, parent = nil)
      @connection, @url, @parent = connection, url, parent
    end
    
    def source
      @source ||= Nokogiri::HTML(get(@url))
    end
    
    def get(*args)
      connection.get(*args)
    end
    
    def post(*args)
      connection.post(*args)
    end
    
    def method_missing(method, *args, &block)
      unless source.respond_to?(method)
        super(method, *args, &block)
      else
        source.send(method, *args, &block)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
wagon-0.10.5 lib/wagon/page.rb
wagon-0.10.4 lib/wagon/page.rb
wagon-0.10.3 lib/wagon/page.rb
wagon-0.10.2 lib/wagon/page.rb
wagon-0.10.1 lib/wagon/page.rb
wagon-0.10.0 lib/wagon/page.rb
wagon-0.9.5 lib/wagon/page.rb
wagon-0.9.4 lib/wagon/page.rb
wagon-0.9.3 lib/wagon/page.rb
wagon-0.9.2 lib/wagon/page.rb