File: fakeio.rb

package info (click to toggle)
ruby-file-validators 3.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 388 kB
  • sloc: ruby: 1,601; makefile: 10
file content (17 lines) | stat: -rw-r--r-- 377 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

require 'forwardable'
require 'stringio'

class FakeIO
  attr_reader :original_filename, :content_type

  def initialize(content, filename: nil, content_type: nil)
    @io = StringIO.new(content)
    @original_filename = filename
    @content_type = content_type
  end

  extend Forwardable
  delegate %i[read rewind eof? close size] => :@io
end