class FakeFtp::File

Attributes

bytes[RW]
created[R]
data[RW]
last_modified_time[RW]
name[RW]
type[W]

Public Class Methods

new(name = nil, data = nil, type = nil, last_modified_time = Time.now) click to toggle source
# File lib/fake_ftp/file.rb, line 8
def initialize(name = nil, data = nil, type = nil, last_modified_time = Time.now)
  @created = Time.now
  @name = name
  @data = data
  # FIXME this is far too ambiguous. args should not mean different
  # things in different contexts.
  data_is_bytes = (data.nil? || Integer === data)
  @bytes = data_is_bytes ? data : data.to_s.length
  @data = data_is_bytes ? nil : data
  @type = type
  @last_modified_time = last_modified_time.utc
end

Public Instance Methods

active?() click to toggle source
# File lib/fake_ftp/file.rb, line 30
def active?
  @type == :active
end
data=(data) click to toggle source
# File lib/fake_ftp/file.rb, line 21
def data=(data)
  @data = data
  @bytes = @data.nil? ? nil : data.length
end
passive?() click to toggle source
# File lib/fake_ftp/file.rb, line 26
def passive?
  @type == :passive
end