Method: Pathname#initialize

Defined in:
lib/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.



203
204
205
206
207
208
209
210
211
212
# File 'lib/pathname.rb', line 203

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

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

  self.taint if @path.tainted?
end