lib/report_formatter/timeline.rb
# Return the name of an icon for a specific table, event pair
Return the name of an icon for a specific table, event pair
Return the name of an icon for a specific table event pair
def timeline_icon(table, event_text)
      unless @icon_hash
        icon_dir = "#{TIMELINES_FOLDER}/icons"
        begin
          data = File.read(File.join(icon_dir, "#{table}.csv")).split("\n")
        rescue
          return table    
        end
        @icon_hash = {}
        data.each do |rec|
          evt, txt = rec.split(",")
          @icon_hash[evt] = txt
        end
      end
      return @icon_hash[event_text] if @icon_hash[event_text]
      table
    end
def timeline_icon ( table , event_text ) unless @icon_hash icon_dir = "#{TIMELINES_FOLDER}/icons" begin data = File . read ( File . join ( icon_dir , "#{table}.csv" ) ) . split ( "\n" ) rescue return table end @icon_hash = { } data . each do | rec | evt , txt = rec . split ( "," ) @icon_hash [ evt ] = txt end end return @icon_hash [ event_text ] if @icon_hash [ event_text ] table end
Return the name of an icon for a specific table, event pair
Return the name of an icon for a specific table event pair
# Create the icon hash, if it doesn't exist yet # If we can't read the file, return the table name as the icon name
table
<not_specific>
event_text
<not_specific>