Class: ScheduleParser

Inherits:
Object
  • Object
show all
Defined in:
lib/schedule_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schedule_path) ⇒ ScheduleParser

Returns a new instance of ScheduleParser.



4
5
6
7
# File 'lib/schedule_parser.rb', line 4

def initialize schedule_path
  @schedule_yaml = schedule_path
  @result_hash = Hash.new
end

Instance Attribute Details

#result_hashObject (readonly)

Returns the value of attribute result_hash.



2
3
4
# File 'lib/schedule_parser.rb', line 2

def result_hash
  @result_hash
end

#schedule_yamlObject (readonly)

Returns the value of attribute schedule_yaml.



2
3
4
# File 'lib/schedule_parser.rb', line 2

def schedule_yaml
  @schedule_yaml
end

Instance Method Details

#download!Object



19
20
21
22
# File 'lib/schedule_parser.rb', line 19

def download!
  download
  store_to_file
end

#group_schedule(group) ⇒ Object



14
15
16
17
# File 'lib/schedule_parser.rb', line 14

def group_schedule(group)
  group = group.to_i
  result_hash[group]
end

#parseObject



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

def parse
  confirm_file
  parse_from_file(schedule_yaml)
end