Class: FuseFS::Stat

Inherits:
Object
  • Object
show all
Defined in:
lib/fusefs.rb

Direct Known Subclasses

DirEntry, FileEntry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = 'undefined') ⇒ Stat

Returns a new instance of Stat.



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/fusefs.rb', line 60

def initialize(name='undefined')
  @st_mode  = 0o755 | mode_mask
  @st_nlink = 3
  @st_size  = 0
  @st_uid   = Process.uid
  @st_gid   = Process.gid
  @st_mtime = Time.now.to_i
  @st_atime = Time.now.to_i
  @st_ctime = Time.now.to_i
  @name     = name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



58
59
60
# File 'lib/fusefs.rb', line 58

def name
  @name
end

#st_atimeObject

Returns the value of attribute st_atime.



56
57
58
# File 'lib/fusefs.rb', line 56

def st_atime
  @st_atime
end

#st_ctimeObject

Returns the value of attribute st_ctime.



57
58
59
# File 'lib/fusefs.rb', line 57

def st_ctime
  @st_ctime
end

#st_gidObject

Returns the value of attribute st_gid.



54
55
56
# File 'lib/fusefs.rb', line 54

def st_gid
  @st_gid
end

#st_modeObject

Returns the value of attribute st_mode.



50
51
52
# File 'lib/fusefs.rb', line 50

def st_mode
  @st_mode
end

#st_mtimeObject

Returns the value of attribute st_mtime.



55
56
57
# File 'lib/fusefs.rb', line 55

def st_mtime
  @st_mtime
end

Returns the value of attribute st_nlink.



51
52
53
# File 'lib/fusefs.rb', line 51

def st_nlink
  @st_nlink
end

#st_sizeObject

Returns the value of attribute st_size.



52
53
54
# File 'lib/fusefs.rb', line 52

def st_size
  @st_size
end

#st_uidObject

Returns the value of attribute st_uid.



53
54
55
# File 'lib/fusefs.rb', line 53

def st_uid
  @st_uid
end

Instance Method Details

#mode_maskObject



72
73
74
# File 'lib/fusefs.rb', line 72

def mode_mask
  self.class == FileEntry ? S_IFREG : S_IFDIR
end