Class: CarmelHockey::Season

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Includes:
HockeyModel
Defined in:
lib/carmel_hockey/season.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HockeyModel

#attributes

Constructor Details

#initialize(attributes = {}) ⇒ Season

Returns a new instance of Season.



9
10
11
12
# File 'lib/carmel_hockey/season.rb', line 9

def initialize(attributes = {})
  super
  self.id = id.to_i
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/carmel_hockey/season.rb', line 7

def id
  @id
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/carmel_hockey/season.rb', line 7

def name
  @name
end

Class Method Details

.allObject



21
22
23
24
25
# File 'lib/carmel_hockey/season.rb', line 21

def all
  page.css('select[name="sel_ChildSeason"] option').map do |option|
    Season.new(id: option.attribute('value').text, name: option.text)
  end
end

Instance Method Details

#leadersObject



14
15
16
# File 'lib/carmel_hockey/season.rb', line 14

def leaders
  Leader.all(season: id)
end