Class: MemFs::Fake::Entry
- Inherits:
-
Object
- Object
- MemFs::Fake::Entry
- Defined in:
- lib/memfs/fake/entry.rb
Constant Summary collapse
- UREAD =
00100
- UWRITE =
00200
- UEXEC =
00400
- GREAD =
00010
- GWRITE =
00020
- GEXEC =
00040
- OREAD =
00001
- OWRITE =
00002
- OEXEC =
00004
- RSTICK =
01000
- USTICK =
05000
- SETUID =
04000
- SETGID =
02000
Instance Attribute Summary collapse
-
#atime ⇒ Object
Returns the value of attribute atime.
-
#block_device ⇒ Object
Returns the value of attribute block_device.
-
#character_device ⇒ Object
Returns the value of attribute character_device.
-
#ctime ⇒ Object
Returns the value of attribute ctime.
-
#gid ⇒ Object
Returns the value of attribute gid.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#mtime ⇒ Object
Returns the value of attribute mtime.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#uid ⇒ Object
Returns the value of attribute uid.
Instance Method Summary collapse
- #blksize ⇒ Object
- #delete ⇒ Object
- #dereferenced ⇒ Object
- #dereferenced_name ⇒ Object
- #dereferenced_path ⇒ Object
- #dev ⇒ Object
- #find(_path) ⇒ Object
-
#initialize(path = nil) ⇒ Entry
constructor
A new instance of Entry.
- #ino ⇒ Object
- #path ⇒ Object
- #paths ⇒ Object
- #touch ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(path = nil) ⇒ Entry
Returns a new instance of Entry.
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/memfs/fake/entry.rb', line 57 def initialize(path = nil) time = Time.now self.atime = time self.ctime = time self.gid = Process.egid self.mode = 0666 - MemFs::File.umask self.mtime = time self.name = MemFs::File.basename(path || '') self.uid = Process.euid end |
Instance Attribute Details
#atime ⇒ Object
Returns the value of attribute atime.
18 19 20 |
# File 'lib/memfs/fake/entry.rb', line 18 def atime @atime end |
#block_device ⇒ Object
Returns the value of attribute block_device.
18 19 20 |
# File 'lib/memfs/fake/entry.rb', line 18 def block_device @block_device end |
#character_device ⇒ Object
Returns the value of attribute character_device.
18 19 20 |
# File 'lib/memfs/fake/entry.rb', line 18 def character_device @character_device end |
#ctime ⇒ Object
Returns the value of attribute ctime.
18 19 20 |
# File 'lib/memfs/fake/entry.rb', line 18 def ctime @ctime end |
#gid ⇒ Object
Returns the value of attribute gid.
18 19 20 |
# File 'lib/memfs/fake/entry.rb', line 18 def gid @gid end |
#mode ⇒ Object
Returns the value of attribute mode.
27 28 29 |
# File 'lib/memfs/fake/entry.rb', line 27 def mode @mode end |
#mtime ⇒ Object
Returns the value of attribute mtime.
18 19 20 |
# File 'lib/memfs/fake/entry.rb', line 18 def mtime @mtime end |
#name ⇒ Object
Returns the value of attribute name.
18 19 20 |
# File 'lib/memfs/fake/entry.rb', line 18 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
18 19 20 |
# File 'lib/memfs/fake/entry.rb', line 18 def parent @parent end |
#uid ⇒ Object
Returns the value of attribute uid.
18 19 20 |
# File 'lib/memfs/fake/entry.rb', line 18 def uid @uid end |
Instance Method Details
#blksize ⇒ Object
29 30 31 |
# File 'lib/memfs/fake/entry.rb', line 29 def blksize 4096 end |
#delete ⇒ Object
33 34 35 |
# File 'lib/memfs/fake/entry.rb', line 33 def delete parent.remove_entry self end |
#dereferenced ⇒ Object
37 38 39 |
# File 'lib/memfs/fake/entry.rb', line 37 def dereferenced self end |
#dereferenced_name ⇒ Object
41 42 43 |
# File 'lib/memfs/fake/entry.rb', line 41 def dereferenced_name name end |
#dereferenced_path ⇒ Object
45 46 47 |
# File 'lib/memfs/fake/entry.rb', line 45 def dereferenced_path path end |
#dev ⇒ Object
49 50 51 |
# File 'lib/memfs/fake/entry.rb', line 49 def dev @dev ||= rand(1000) end |
#find(_path) ⇒ Object
53 54 55 |
# File 'lib/memfs/fake/entry.rb', line 53 def find(_path) fail Errno::ENOTDIR, path end |
#ino ⇒ Object
68 69 70 |
# File 'lib/memfs/fake/entry.rb', line 68 def ino @ino ||= rand(1000) end |
#path ⇒ Object
76 77 78 79 |
# File 'lib/memfs/fake/entry.rb', line 76 def path parts = [parent && parent.path, name].compact MemFs::File.join(parts) end |
#paths ⇒ Object
81 82 83 |
# File 'lib/memfs/fake/entry.rb', line 81 def paths [path] end |
#touch ⇒ Object
85 86 87 |
# File 'lib/memfs/fake/entry.rb', line 85 def touch self.atime = self.mtime = Time.now end |
#type ⇒ Object
89 90 91 |
# File 'lib/memfs/fake/entry.rb', line 89 def type 'unknown' end |