class TSparser::EPG

Attributes

epg[R]

Public Class Methods

new(epg_hash=Hash.new) click to toggle source
# File lib/epg.rb, line 5
def initialize(epg_hash=Hash.new)
  @epg = epg_hash
end

Public Instance Methods

+(other) click to toggle source
# File lib/epg.rb, line 15
def +(other)
  new_hash = @epg.merge(other.epg) do |event_id, attr_hash1, attr_hash2|
    attr_hash1.merge(attr_hash2) do |attr_name, val1, val2|
      [val1, val2].max{|a, b| a.to_s.size <=> b.to_s.size}
    end
  end
  return EPG.new(new_hash)
end
add(event_id, attr_hash) click to toggle source
# File lib/epg.rb, line 9
def add(event_id, attr_hash)
  @epg[event_id] = attr_hash
end
each(&block) click to toggle source
# File lib/epg.rb, line 24
def each(&block)
  @epg.each_value(&block)
end