All pastes #46662 Raw Edit

Unnamed

public ruby v1 · immutable
#46662 ·published 2006-03-22 23:09 UTC
rendered paste body
#!/bin/env ruby# $Id$require 'game'require 'language_extensions'require 'rexml/document'include REXMLclass XBoxService  attr_accessor :url    def initialize(url = 'http://xbox.foo.net/xmlservice.php')    if url.nil?      raise ArgumentError, "Please specify a non-nil URL endpoint in the constructor."    else       @url = url    end  end    def get_games    Document.new(@url.fetch_as_url).to_games   end    def add_vote(game)    unless game.respond_to?(:to_vote_xml)      raise ArgumentError, "Object must respond to :to_vote_xml"    else       raise NotImplementedError    end  end  end