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
10
11
# File 'lib/bfs.rb', line 6

def initialize(**attrs)
  super(nil)

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

Instance Method Details

#content_typeObject



21
22
23
# File 'lib/bfs.rb', line 21

def content_type
  fetch(:content_type, nil)
end

#metadataObject



33
34
35
# File 'lib/bfs.rb', line 33

def 
  fetch(:metadata, {})
end

#modeObject



29
30
31
# File 'lib/bfs.rb', line 29

def mode
  fetch(:mode, 0)
end

#mtimeObject



25
26
27
# File 'lib/bfs.rb', line 25

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

#pathObject



13
14
15
# File 'lib/bfs.rb', line 13

def path
  fetch(:path, nil)
end

#sizeObject



17
18
19
# File 'lib/bfs.rb', line 17

def size
  fetch(:size, 0)
end