class AhlScraper::Seasons::Team
Constants
- EXCEPTIONS
Attributes
division[R]
Public Class Methods
new(raw_data, division)
click to toggle source
# File lib/ahl_scraper/resources/seasons/team.rb, line 31 def initialize(raw_data, division) @raw_data = raw_data @division = division end
Public Instance Methods
abbreviation()
click to toggle source
# File lib/ahl_scraper/resources/seasons/team.rb, line 44 def abbreviation @abbreviation ||= EXCEPTIONS[parameterized_name]&.dig(:abbreviation) || @raw_data.dig(:row, :team_code)&.delete_prefix("y -")&.delete_prefix("x -")&.delete_prefix("xy -")&.strip end
city()
click to toggle source
# File lib/ahl_scraper/resources/seasons/team.rb, line 52 def city @city ||= full_name.split.length > 2 ? exception_split_object&.dig(:city) : full_name.split[0] end
full_name()
click to toggle source
# File lib/ahl_scraper/resources/seasons/team.rb, line 40 def full_name @full_name ||= @raw_data.dig(:row, :name)&.delete_prefix("y -")&.delete_prefix("x -")&.delete_prefix("xy -")&.strip end
game_file_city()
click to toggle source
# File lib/ahl_scraper/resources/seasons/team.rb, line 60 def game_file_city @game_file_city ||= EXCEPTIONS[parameterized_name]&.dig(:game_file_city) end
id()
click to toggle source
# File lib/ahl_scraper/resources/seasons/team.rb, line 36 def id @id ||= @raw_data.dig(:prop, :team_code, :teamLink)&.to_i end
name()
click to toggle source
# File lib/ahl_scraper/resources/seasons/team.rb, line 56 def name @name ||= full_name.split.length > 2 ? exception_split_object&.dig(:name) : full_name.split[1] end
parameterized_name()
click to toggle source
# File lib/ahl_scraper/resources/seasons/team.rb, line 48 def parameterized_name @parameterized_name ||= ParameterizeHelper.new(full_name).call end
Private Instance Methods
exception_split_object()
click to toggle source
# File lib/ahl_scraper/resources/seasons/team.rb, line 66 def exception_split_object @exception_split_object ||= if !EXCEPTIONS[parameterized_name] puts "Three word team name #{full_name} not recognized, must manually decipher team name and city" {} else EXCEPTIONS[parameterized_name] end end