Class: TorqueBox::VFS::File::Stat

Inherits:
Object
  • Object
show all
Defined in:
lib/torquebox/vfs/file.rb

Instance Method Summary collapse

Constructor Details

#initialize(virtual_file) ⇒ Stat

Returns a new instance of Stat.



22
23
24
# File 'lib/torquebox/vfs/file.rb', line 22

def initialize(virtual_file)
  @virtual_file = virtual_file
end

Instance Method Details

#atimeObject



30
31
32
# File 'lib/torquebox/vfs/file.rb', line 30

def atime()
  Time.at( @virtual_file.last_modified )
end

#blksizeObject



34
35
36
# File 'lib/torquebox/vfs/file.rb', line 34

def blksize
  nil
end

#blockdev?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/torquebox/vfs/file.rb', line 38

def blockdev?
  false
end

#blocksObject



42
43
44
# File 'lib/torquebox/vfs/file.rb', line 42

def blocks
  nil
end

#chardev?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/torquebox/vfs/file.rb', line 46

def chardev?
  true
end

#cmp(other) ⇒ Object



26
27
28
# File 'lib/torquebox/vfs/file.rb', line 26

def cmp(other)
  @virtual_file.last_modified <=> other.last_modified
end

#ctimeObject



50
51
52
# File 'lib/torquebox/vfs/file.rb', line 50

def ctime
  Time.at( @virtual_file.last_modified )
end

#devObject



54
55
56
# File 'lib/torquebox/vfs/file.rb', line 54

def dev
  nil
end

#dev_majorObject



58
59
60
# File 'lib/torquebox/vfs/file.rb', line 58

def dev_major
  nil
end

#dev_minorObject



62
63
64
# File 'lib/torquebox/vfs/file.rb', line 62

def dev_minor
  nil
end

#directory?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/torquebox/vfs/file.rb', line 66

def directory?
  @virtual_file.exists && ! @virtual_file.is_leaf 
end

#executable?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/torquebox/vfs/file.rb', line 70

def executable?
  false
end

#executable_real?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/torquebox/vfs/file.rb', line 74

def executable_real?
  false
end

#file?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/torquebox/vfs/file.rb', line 78

def file?
  true
end

#ftypeObject



82
83
84
85
# File 'lib/torquebox/vfs/file.rb', line 82

def ftype
  return 'file' if @virtual_file.is_leaf
  'directory'
end

#gidObject



87
88
89
# File 'lib/torquebox/vfs/file.rb', line 87

def gid
  nil
end

#grpowned?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/torquebox/vfs/file.rb', line 91

def grpowned?
  false
end

#inoObject



95
96
97
# File 'lib/torquebox/vfs/file.rb', line 95

def ino
  nil
end

#modeObject



99
100
101
# File 'lib/torquebox/vfs/file.rb', line 99

def mode
  0x444
end

#mtimeObject



103
104
105
# File 'lib/torquebox/vfs/file.rb', line 103

def mtime
  Time.at( @virtual_file.getLastModified() / 1000 )
end


107
108
109
# File 'lib/torquebox/vfs/file.rb', line 107

def nlink
  1
end

#owned?Boolean

Returns:

  • (Boolean)


111
112
113
# File 'lib/torquebox/vfs/file.rb', line 111

def owned?
  false
end

#pipe?Boolean

Returns:

  • (Boolean)


115
116
117
# File 'lib/torquebox/vfs/file.rb', line 115

def pipe?
  false
end

#rdevObject



119
120
121
# File 'lib/torquebox/vfs/file.rb', line 119

def rdev
  nil
end

#rdev_majorObject



123
124
125
# File 'lib/torquebox/vfs/file.rb', line 123

def rdev_major
  nil
end

#rdev_minorObject



127
128
129
# File 'lib/torquebox/vfs/file.rb', line 127

def rdev_minor
  nil
end

#readable?Boolean

Returns:

  • (Boolean)


131
132
133
# File 'lib/torquebox/vfs/file.rb', line 131

def readable?
  true
end

#readable_real?Boolean

Returns:

  • (Boolean)


135
136
137
# File 'lib/torquebox/vfs/file.rb', line 135

def readable_real?
  true
end

#setgid?Boolean

Returns:

  • (Boolean)


139
140
141
# File 'lib/torquebox/vfs/file.rb', line 139

def setgid?
  false
end

#setuid?Boolean

Returns:

  • (Boolean)


143
144
145
# File 'lib/torquebox/vfs/file.rb', line 143

def setuid?
  false
end

#sizeObject



147
148
149
# File 'lib/torquebox/vfs/file.rb', line 147

def size
  @virtual_file.size
end

#socket?Boolean

Returns:

  • (Boolean)


151
152
153
# File 'lib/torquebox/vfs/file.rb', line 151

def socket?
  false
end

#sticky?Boolean

Returns:

  • (Boolean)


155
156
157
# File 'lib/torquebox/vfs/file.rb', line 155

def sticky?
  false
end

#symlink?Boolean

Returns:

  • (Boolean)


159
160
161
# File 'lib/torquebox/vfs/file.rb', line 159

def symlink?
  false
end

#uidObject



163
164
165
# File 'lib/torquebox/vfs/file.rb', line 163

def uid
  nil
end

#writable?Boolean

Returns:

  • (Boolean)


167
168
169
170
171
172
173
174
# File 'lib/torquebox/vfs/file.rb', line 167

def writable?
  begin
    physical_file = @virtual_file.physical_file
    physical_file.canWrite
  rescue => e
    false
  end
end

#writable_real?Boolean

Returns:

  • (Boolean)


176
177
178
# File 'lib/torquebox/vfs/file.rb', line 176

def writable_real?
  writable?
end

#zero?Boolean

Returns:

  • (Boolean)


180
181
182
# File 'lib/torquebox/vfs/file.rb', line 180

def zero?
  self.size == 0
end