Class: BFS::FileInfo

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

Instance Method Summary collapse

Constructor Details

#initialize(**attrs) ⇒ FileInfo

Returns a new instance of FileInfo.



6
7
8
9
# File 'lib/bfs.rb', line 6

def initialize(**attrs)
  update(size: 0, mtime: Time.at(0), mode: 0, metadata: {})
  update(attrs)
end

Instance Method Details

#content_typeObject



19
20
21
# File 'lib/bfs.rb', line 19

def content_type
  fetch(:content_type, nil)
end

#metadataObject



31
32
33
# File 'lib/bfs.rb', line 31

def 
  fetch(:metadata, {})
end

#modeObject



27
28
29
# File 'lib/bfs.rb', line 27

def mode
  fetch(:mode, 0)
end

#mtimeObject



23
24
25
# File 'lib/bfs.rb', line 23

def mtime
  fetch(:mtime, Time.at(0))
end

#pathObject



11
12
13
# File 'lib/bfs.rb', line 11

def path
  fetch(:path, nil)
end

#sizeObject



15
16
17
# File 'lib/bfs.rb', line 15

def size
  fetch(:size, 0)
end