Class: Sutazekarate::Timetable

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Attributes, ActiveModel::Model, ActiveModel::Serializers::JSON
Defined in:
lib/sutazekarate/timetable.rb

Class Method Summary collapse

Class Method Details

.build(location_element, categories: []) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sutazekarate/timetable.rb', line 10

def self.build(location_element, categories: [])
  location = location_element.search('.hlavicka').text.strip

  entries = location_element.search('ul li').map do |entry_element|
    TimetableEntry.build(entry_element, categories:)
  end

  Timetable.new(
    location:,
    entries:,
  )
end