Class: DashTimelineValidator::Report

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

Class Method Summary collapse

Class Method Details

.duration_iso8601_to_i(start) ⇒ Object



34
35
36
# File 'lib/dash_timeline_validator/report.rb', line 34

def self.duration_iso8601_to_i(start)
  ISO8601::Duration.new(start).to_seconds
end

.fill_report(report, mpd_leaf, key_name, default_value = nil, parser_fn = :identity) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/dash_timeline_validator/report.rb', line 17

def self.fill_report(report, mpd_leaf, key_name, default_value = nil, parser_fn = :identity)
  if mpd_leaf.respond_to? key_name
    report[key_name] = Report.report_info(self.send(parser_fn, mpd_leaf[key_name]))
  elsif default_value
    report[key_name] = Report.report_info(self.send(parser_fn, default_value))
  end
end

.fill_report_mandatory(report, mpd_leaf, key_name, parser_fn = :identity) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/dash_timeline_validator/report.rb', line 25

def self.fill_report_mandatory(report, mpd_leaf, key_name, parser_fn = :identity)
  if !mpd_leaf.respond_to? key_name
    report[key_name] = report_error("Mandatory #{key_name} is missing")
    error_exit(report)
  else
    report[key_name] = Report.report_info(self.send(parser_fn, mpd_leaf[key_name]))
  end
end

.identity(value) ⇒ Object



42
43
44
# File 'lib/dash_timeline_validator/report.rb', line 42

def self.identity(value)
  value
end

.report_error(value) ⇒ Object



13
14
15
# File 'lib/dash_timeline_validator/report.rb', line 13

def self.report_error(value)
  "[ERROR] #{value}"
end

.report_info(value) ⇒ Object



5
6
7
# File 'lib/dash_timeline_validator/report.rb', line 5

def self.report_info(value)
  value
end

.report_warn(value) ⇒ Object



9
10
11
# File 'lib/dash_timeline_validator/report.rb', line 9

def self.report_warn(value)
  "[WARN] #{value}"
end

.time_to_i(value) ⇒ Object



38
39
40
# File 'lib/dash_timeline_validator/report.rb', line 38

def self.time_to_i(value)
  Time.parse(value).to_i
end

.to_i(value) ⇒ Object



46
47
48
# File 'lib/dash_timeline_validator/report.rb', line 46

def self.to_i(value)
  value.to_i
end