Sha256: bf1306e3940559a6625552b4628671cd97a4bdfc83d46511ed3e07329f556aa2

Contents?: true

Size: 625 Bytes

Versions: 5

Compression:

Stored size: 625 Bytes

Contents

module FakeFtp
  class File
    attr_accessor :bytes, :name
    attr_writer :type
    attr_accessor :data
    attr_reader :created

    def initialize(name = nil, data = nil, type = nil)
      @created = Time.now
      @name = name
      @data = data
      data_is_bytes = (data.nil? || Integer === data)
      @bytes = data_is_bytes ? data : data.length
      @data = data_is_bytes ? nil : data
      @type = type
    end

    def data=(data)
      @data = data
      @bytes = @data.nil? ? nil : data.length
    end

    def passive?
      @type == :passive
    end

    def active?
      @type == :active
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fake_ftp-0.0.9 lib/fake_ftp/file.rb
fake_ftp-0.0.8 lib/fake_ftp/file.rb
fake_ftp-0.0.7 lib/fake_ftp/file.rb
fake_ftp-0.0.6 lib/fake_ftp/file.rb
fake_ftp-0.0.5 lib/fake_ftp/file.rb