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 9
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? || data.is_a?(Integer))
  @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 36
def active?
  @type == :active
end
basename() click to toggle source
# File lib/fake_ftp/file.rb, line 23
def basename
  ::File.basename(@name)
end
data=(data) click to toggle source
# File lib/fake_ftp/file.rb, line 27
def data=(data)
  @data = data
  @bytes = @data.nil? ? nil : data.length
end
passive?() click to toggle source
# File lib/fake_ftp/file.rb, line 32
def passive?
  @type == :passive
end