Sha256: 2a269299e381f8e45638c724d720a2dce00a483cc5ebd35485001e39a3c113be
Contents?: true
Size: 947 Bytes
Versions: 1
Compression:
Stored size: 947 Bytes
Contents
module Rack module Logs class Viewer def initialize config @config = config end attr_reader :config def call env [200, headers, joined_logs] end private def headers { 'Content-Type' => 'text/plain' } end class JoinedFiles def initialize filenames @filenames = filenames end def each &block @filenames.each do |filename| block.call "## #{filename}\n\n" ::File.open(filename) do |file| file.each(&block) end end end end def joined_logs JoinedFiles.new files end def logs files.inject({}) do |hash, filename| hash[filename] = ::File.read(filename) hash end end def files Dir[@config.log_dir+'/'+@config.pattern] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rack-logs-0.0.2 | lib/rack/logs/viewer.rb |