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
class StonePaperScissor | |
@@rules = Hash.new(:draw).merge({ | |
[:stone, :scissor] => :left_wins, | |
[:stone, :paper] => :right_wins, | |
[:paper, :scissor] => :right_wins, | |
[:paper, :stone] => :left_wins, | |
[:scissor, :stone] => :right_wins, |
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' | |
# tá aqui o orçamento executado de 2011 da camara de sp | |
#http://www.camara.sp.gov.br/index.php?option=com_wrapper&view=wrapper&Itemid=219 | |
xml = File.read "COMPLETO.xml" | |
p = lambda { |i| i.inner_text.gsub(",", ".").to_f } | |
def m fl | |
"%1.2f" % fl | |
end | |
doc = Nokogiri::XML(xml) | |
fornecedores = doc.xpath("//fornecedor").collect { |i| i.attribute("nome").value }.uniq |