Class: NbaPlayer
- Inherits:
-
Object
- Object
- NbaPlayer
- Includes:
- NbaUrls
- Defined in:
- lib/espnscrape/NbaPlayer.rb
Overview
Read basic bio info from ESPN Player page
Instance Attribute Summary collapse
-
#age ⇒ Integer
Age.
-
#college ⇒ String
College.
-
#h_ft ⇒ Integer
Height (ft).
-
#h_in ⇒ Integer
Height (in).
-
#name ⇒ String
Name.
-
#position ⇒ String
Position.
-
#weight ⇒ Integer
Weight.
Instance Method Summary collapse
-
#height_ft ⇒ Object
alias for h_ft.
-
#height_in ⇒ Object
alias for h_in.
-
#initialize(espn_player_id, file = '') ⇒ NbaPlayer
constructor
Read Player Data.
Methods included from NbaUrls
#boxScoreUrl, #checkSpecial, #formatTeamUrl, #getTid, #playerUrl, #seasonYearEnd, #seasonYears, #teamListUrl, #teamRosterUrl, #teamScheduleUrl
Constructor Details
#initialize(espn_player_id, file = '') ⇒ NbaPlayer
Read Player Data
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/espnscrape/NbaPlayer.rb', line 21 def initialize(espn_player_id, file = '') espn_player_id = espn_player_id.to_s if !espn_player_id.empty? url = playerUrl + espn_player_id doc = Nokogiri::HTML(open(url)) else doc = Nokogiri::HTML(open(file)) rescue nil end return if doc.nil? readInfo(doc) end |
Instance Attribute Details
#age ⇒ Integer
Returns Age.
10 11 12 |
# File 'lib/espnscrape/NbaPlayer.rb', line 10 def age @age end |
#college ⇒ String
Returns College.
12 13 14 |
# File 'lib/espnscrape/NbaPlayer.rb', line 12 def college @college end |
#h_ft ⇒ Integer
Returns Height (ft).
16 17 18 |
# File 'lib/espnscrape/NbaPlayer.rb', line 16 def h_ft @h_ft end |
#h_in ⇒ Integer
Returns Height (in).
18 19 20 |
# File 'lib/espnscrape/NbaPlayer.rb', line 18 def h_in @h_in end |
#position ⇒ String
Returns Position.
8 9 10 |
# File 'lib/espnscrape/NbaPlayer.rb', line 8 def position @position end |
#weight ⇒ Integer
Returns Weight.
14 15 16 |
# File 'lib/espnscrape/NbaPlayer.rb', line 14 def weight @weight end |
Instance Method Details
#height_ft ⇒ Object
alias for h_ft
35 36 37 |
# File 'lib/espnscrape/NbaPlayer.rb', line 35 def height_ft @h_ft end |
#height_in ⇒ Object
alias for h_in
40 41 42 |
# File 'lib/espnscrape/NbaPlayer.rb', line 40 def height_in @h_in end |