Sha256: 5f60004487014ad77372edc5e090b6b43e787837962f69fbf320e9ee00228751
Contents?: true
Size: 1.23 KB
Versions: 3
Compression:
Stored size: 1.23 KB
Contents
require 'rubygems' require 'hpricot' require 'open-uri' module Pokerstats class PokerEdge def initialize screen_name @screen_name = URI.escape(screen_name) end def get_response_from_internet url = "http://www.poker-edge.com/whoami.php?name=#{@screen_name}" puts url open(url) do |f| @response = f.read end @response end def response @response ||= get_response_from_internet end def preflop_style if self.response =~ /(Pre-Flop Tend.*\n)/ verbose = $1.gsub(/<\/?[^>]*>/, "") if verbose =~ /Pre-Flop Tendency: ([^-]*) -/ preflop_style = $1 else preflop_style = "N/A" end end preflop_style end def player_type if response =~ /(Player Type.*\n)/ verbose = $1.gsub(/<\/?[^>]*>/, "") if verbose =~ /[Yy]ou are a ([^(]* \(.*\))/ player = $1 else player = "" end end player end def report format = "%20s -- %s -- %s\n" # open("foo.html", "w+") do |file| # file.write(response) # end # `open foo.html` printf(format, @screen_name, preflop_style, player_type) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pokerstats-2.3.0 | lib/pokerstats/poker-edge.rb |
pokerstats-2.2.0 | lib/pokerstats/poker-edge.rb |
pokerstats-2.1.0 | lib/pokerstats/poker-edge.rb |