class Path::Backend::Mock::Node

Attributes

atime[RW]
mode[RW]
mtime[RW]
name[R]
parent[R]
sys[R]

Public Class Methods

new(backend, name, _ops = {}) click to toggle source
# File lib/rubypath/backend/mock.rb, line 272
def initialize(backend, name, _ops = {})
  @sys   = backend
  @name  = name
  @mtime = Time.now
  @atime = Time.now
end

Public Instance Methods

added(parent) click to toggle source
# File lib/rubypath/backend/mock.rb, line 292
def added(parent)
  @parent = parent
end
lookup(_path) click to toggle source
# File lib/rubypath/backend/mock.rb, line 288
def lookup(_path)
  raise NotImplementError.new 'Subclass responsibility.'
end
mtime=(time) click to toggle source
# File lib/rubypath/backend/mock.rb, line 279
def mtime=(time)
  if time.is_a?(Time)
    @mtime = time
  else
    raise "Not Time but `#{time.inspect}` " \
          "of `#{time.class.name}` given."
  end
end
path() click to toggle source
# File lib/rubypath/backend/mock.rb, line 296
def path
  parent ? "#{parent.path}/#{name}" : name
end