Sha256: a459bfd709dded1f7be8a2f4949900974b6e49eb960cc6179b5e8ba376edb3bf

Contents?: true

Size: 832 Bytes

Versions: 2

Compression:

Stored size: 832 Bytes

Contents

module FLV
  module Edit  
    module Processor
      
      # Printer is a small utility class to print out FLV chunks.
      class Printer
        def initialize(io, options={})
          @io = io
          @options = {:width => 50, :column_width => 15, :separator => "| "}.merge(options)
          @margin_left = ""
        end

        def header(left, right)
          @io.puts left + @options[:separator] + right
          @margin_left = " "*left.length + @options[:separator]
        end

        # Prints out a hash (or any list of key-value pairs) in two columns
        def values(hash)
          hash.map{|k,v| [k.to_s, v] }.sort.each do |key, value|
            @io.puts "#{@margin_left}#{key.to_s.ljust(@options[:column_width])}: #{value.inspect.delete(':"')}"
          end
        end
      end
    
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
marcandre-flvedit-0.6.2 lib/flv/edit/processor/printer.rb
flvedit-0.6.2 lib/flv/edit/processor/printer.rb