Sha256: 84bfb39fe8cee735136af80bc30b7b058b5ae7c5263a2531e2494a15bfc3f074
Contents?: true
Size: 713 Bytes
Versions: 3
Compression:
Stored size: 713 Bytes
Contents
# Author:: Marco Tessari <marco.tessari@epita.fr>. # Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved. # License:: LGPL # $Id: cut_output.rb 567 2005-04-13 08:00:06Z polrop $ require 'io/filters' class IO # :nodoc: class CutInput < InputFilter def initialize(io, lines=10, column=80) i = 0 super(io) do |line| if @input.closed? '' elsif i >= lines @input.close "...\n" else i += 1 line.length <= column ? line : (line[0..column].chomp + "\n") end end end end # class CutInput end # module IO #FIXME: adapt me to a real unit test suite # if $0 == __FILE__ # print TTK::Tools::Cutoutput.cut(File.new('./cut_output.rb'), 5, 7) # end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ttk-0.1.576 | lib/ttk/Tools/cut_output.rb |
ttk-0.1.579 | lib/ttk/Tools/cut_output.rb |
ttk-0.1.580 | lib/ttk/Tools/cut_output.rb |