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.



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

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.



264
265
266
# File 'lib/rubypath/backend/mock.rb', line 264

def atime
  @atime
end

#modeObject

Returns the value of attribute mode.



264
265
266
# File 'lib/rubypath/backend/mock.rb', line 264

def mode
  @mode
end

#mtimeObject

Returns the value of attribute mtime.



264
265
266
# File 'lib/rubypath/backend/mock.rb', line 264

def mtime
  @mtime
end

#nameObject (readonly)

Returns the value of attribute name.



263
264
265
# File 'lib/rubypath/backend/mock.rb', line 263

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



263
264
265
# File 'lib/rubypath/backend/mock.rb', line 263

def parent
  @parent
end

#sysObject (readonly)

Returns the value of attribute sys.



263
264
265
# File 'lib/rubypath/backend/mock.rb', line 263

def sys
  @sys
end

Instance Method Details

#added(parent) ⇒ Object



285
286
287
# File 'lib/rubypath/backend/mock.rb', line 285

def added(parent)
  @parent = parent
end

#lookup(path) ⇒ Object



281
282
283
# File 'lib/rubypath/backend/mock.rb', line 281

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

#pathObject



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

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