Class: Path::Backend::Mock::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypath/backend/mock.rb

Direct Known Subclasses

Dir, File

Internal Virtual File System collapse

Internal Virtual File System collapse

Constructor Details

#initialize(backend, name, _ops = {}) ⇒ Node

Returns a new instance of Node.



272
273
274
275
276
277
# File 'lib/rubypath/backend/mock.rb', line 272

def initialize(backend, name, _ops = {})
  @sys   = backend
  @name  = name
  @mtime = Time.now
  @atime = Time.now
end

Instance Attribute Details

#atimeObject

Returns the value of attribute atime.



270
271
272
# File 'lib/rubypath/backend/mock.rb', line 270

def atime
  @atime
end

#modeObject

Returns the value of attribute mode.



270
271
272
# File 'lib/rubypath/backend/mock.rb', line 270

def mode
  @mode
end

#mtimeObject

Returns the value of attribute mtime.



270
271
272
# File 'lib/rubypath/backend/mock.rb', line 270

def mtime
  @mtime
end

#nameObject (readonly)

Returns the value of attribute name.



269
270
271
# File 'lib/rubypath/backend/mock.rb', line 269

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



269
270
271
# File 'lib/rubypath/backend/mock.rb', line 269

def parent
  @parent
end

#sysObject (readonly)

Returns the value of attribute sys.



269
270
271
# File 'lib/rubypath/backend/mock.rb', line 269

def sys
  @sys
end

Instance Method Details

#added(parent) ⇒ Object



292
293
294
# File 'lib/rubypath/backend/mock.rb', line 292

def added(parent)
  @parent = parent
end

#lookup(_path) ⇒ Object



288
289
290
# File 'lib/rubypath/backend/mock.rb', line 288

def lookup(_path)
  raise NotImplementError.new 'Subclass responsibility.'
end

#pathObject



296
297
298
# File 'lib/rubypath/backend/mock.rb', line 296

def path
  parent ? "#{parent.path}/#{name}" : name
end