Method: FakeFS::Pathname#initialize

Defined in:
lib/fakefs/pathname.rb

#initialize(path) ⇒ Pathname

Create a Pathname object from the given String (or String-like object). If path contains a NUL character (\0), an ArgumentError is raised.



33
34
35
36
37
38
39
40
41
42
# File 'lib/fakefs/pathname.rb', line 33

def initialize(path)
  path = path.__send__(TO_PATH) if path.respond_to? TO_PATH
  @path = path.dup

  if /\0/ =~ @path
    fail ArgumentError, "pathname contains \\0: #{@path.inspect}"
  end

  taint if @path.tainted?
end