Sha256: eaad7146322cf0547f8406751091fe491f1d1623cc4e7f260ba4a81a4c1bb3c3

Contents?: true

Size: 893 Bytes

Versions: 2

Compression:

Stored size: 893 Bytes

Contents

module RequestLogAnalyzer
  
  class Output
    
    attr_accessor :io, :options, :style
    
    def self.const_missing(const)
      filename = const.to_s.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase
      require File.dirname(__FILE__) + '/output/' + filename
      self.const_get(const)
    end
    
    def initialize(io, options = {})
      @io      = io
      @options = options
      @style   = options[:style] || { :cell_separator => true, :table_border => false }
    end

    def with_style(temp_style = {})
      old_style = @style
      @style = @style.merge(temp_style)
      yield(self) if block_given?
      @style = old_style
    end    
    
    def header
    end
    
    def footer
    end
    
    protected
    
    def table_has_header?(columns)
      columns.any? { |column| !column[:title].nil? } 
    end
    
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
wvanbergen-request-log-analyzer-1.1.0 lib/request_log_analyzer/output.rb
request-log-analyzer-1.1.0 lib/request_log_analyzer/output.rb