Class: FakeFS::File::Stat
- Inherits:
-
Object
- Object
- FakeFS::File::Stat
- Defined in:
- lib/fakefs/file.rb
Instance Method Summary collapse
- #directory? ⇒ Boolean
-
#initialize(file, __lstat = false) ⇒ Stat
constructor
A new instance of Stat.
- #nlink ⇒ Object
- #size ⇒ Object
- #symlink? ⇒ Boolean
Constructor Details
#initialize(file, __lstat = false) ⇒ Stat
Returns a new instance of Stat.
210 211 212 213 214 215 216 217 |
# File 'lib/fakefs/file.rb', line 210 def initialize(file, __lstat = false) if !File.exists?(file) raise(Errno::ENOENT, "No such file or directory - #{file}") end @file = file @__lstat = __lstat end |
Instance Method Details
#directory? ⇒ Boolean
223 224 225 |
# File 'lib/fakefs/file.rb', line 223 def directory? File.directory?(@file) end |
#nlink ⇒ Object
227 228 229 |
# File 'lib/fakefs/file.rb', line 227 def nlink FileSystem.find(@file).links.size end |
#size ⇒ Object
231 232 233 234 235 236 237 |
# File 'lib/fakefs/file.rb', line 231 def size if @__lstat && symlink? FileSystem.find(@file).target.size else File.size(@file) end end |