Sha256: d7d3736af165c61cb87294b0b471c03fec8dd09207f6990973fc61545dfa8978

Contents?: true

Size: 1.01 KB

Versions: 45

Compression:

Stored size: 1.01 KB

Contents

module Zip
  module IOExtras
    # Implements many of the output convenience methods of IO.
    # relies on <<
    module AbstractOutputStream
      include FakeIO

      def write(data)
        self << data
        data.to_s.bytesize
      end

      def print(*params)
        self << params.join($OUTPUT_FIELD_SEPARATOR) << $OUTPUT_RECORD_SEPARATOR.to_s
      end

      def printf(a_format_string, *params)
        self << format(a_format_string, *params)
      end

      def putc(an_object)
        self << case an_object
                when Integer
                  an_object.chr
                when String
                  an_object
                else
                  raise TypeError, 'putc: Only Integer and String supported'
                end
        an_object
      end

      def puts(*params)
        params << "\n" if params.empty?
        params.flatten.each do |element|
          val = element.to_s
          self << val
          self << "\n" unless val[-1, 1] == "\n"
        end
      end
    end
  end
end

Version data entries

45 entries across 35 versions & 8 rubygems

Version Path
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/rubyzip-2.3.2/lib/zip/ioextras/abstract_output_stream.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
rubyzip-2.3.2 lib/zip/ioextras/abstract_output_stream.rb
rubyzip-2.3.1 lib/zip/ioextras/abstract_output_stream.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/rubyzip-2.3.0/lib/zip/ioextras/abstract_output_stream.rb