Class: Pokerstats::PokerEdge
- Inherits:
-
Object
- Object
- Pokerstats::PokerEdge
- Defined in:
- lib/pokerstats/poker-edge.rb
Instance Method Summary collapse
- #get_response_from_internet ⇒ Object
-
#initialize(screen_name) ⇒ PokerEdge
constructor
A new instance of PokerEdge.
- #player_type ⇒ Object
- #preflop_style ⇒ Object
- #report(format = "%20s -- %s -- %s\n") ⇒ Object
- #response ⇒ Object
Constructor Details
#initialize(screen_name) ⇒ PokerEdge
Returns a new instance of PokerEdge.
8 9 10 |
# File 'lib/pokerstats/poker-edge.rb', line 8 def initialize screen_name @screen_name = URI.escape(screen_name) end |
Instance Method Details
#get_response_from_internet ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/pokerstats/poker-edge.rb', line 12 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 |
#player_type ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/pokerstats/poker-edge.rb', line 37 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 |
#preflop_style ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pokerstats/poker-edge.rb', line 25 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 |
#report(format = "%20s -- %s -- %s\n") ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/pokerstats/poker-edge.rb', line 49 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 |
#response ⇒ Object
21 22 23 |
# File 'lib/pokerstats/poker-edge.rb', line 21 def response @response ||= get_response_from_internet end |