Class: TSparser::EventInformationSection
- Inherits:
-
Object
- Object
- TSparser::EventInformationSection
- Includes:
- Parsing
- Defined in:
- lib/definition/event_information_section.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Parsing
included, #initialize, #method_missing, #read, #rest_all
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class TSparser::Parsing
Class Method Details
.section_length_enough?(section_binary) ⇒ Boolean
6 7 8 9 |
# File 'lib/definition/event_information_section.rb', line 6 def self.section_length_enough?(section_binary) section_length = (section_binary.b(1, 0..3) << 8) + section_binary.b(2) return section_binary.length >= section_length + 3 end |
Instance Method Details
#to_epg ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/definition/event_information_section.rb', line 33 def to_epg epg = EPG.new events.each do |event| attr_hash = { :event_id => event.event_id, :start_time => event.start_time.to_s, :duration => event.duration.to_sec } event.descriptors.each do |desc| case desc when ShortEventDescriptor attr_hash[:name] = desc.event_name.to_utf_8 attr_hash[:description] = desc.text.to_utf_8 end end epg.add(event.event_id, attr_hash) if attr_hash[:name] end return epg end |