Method: Utilities#split_nsh_path

Defined in:
lib/utilities.rb

#split_nsh_path(path) ⇒ Object

Splits the server and path from an nsh path returns same path if no server prepended

Attributes

  • path - nsh path

Returns

array [server, path] server is blank if not present



164
165
166
167
168
169
# File 'lib/utilities.rb', line 164

def split_nsh_path(path)
  result = ["",path]
  result[0] = path.split("/")[2] if path.start_with?("//")
  result[1] = "/#{path.split("/")[3..-1].join("/")}" if path.start_with?("//")
  result
end