Top Level Namespace

Defined Under Namespace

Modules: FFI

Instance Method Summary collapse

Instance Method Details

#shellescape(str) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/ffi-compiler/shell.rb', line 4

def shellescape(str)
    return str unless str
    if FFI::Platform::OS == 'windows'
        '"' + str.gsub('"', '""') + '"'
    else
        str.shellescape
    end
end

#shelljoin(args) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/ffi-compiler/shell.rb', line 13

def shelljoin(args)
    if FFI::Platform::OS == 'windows'
        args.reduce { |cmd, arg| cmd + ' ' + shellescape(arg) }
    else
        args.shelljoin
    end
end

#shellsplit(str) ⇒ Object



21
22
23
24
# File 'lib/ffi-compiler/shell.rb', line 21

def shellsplit(str)
    return str unless str
    str.shellsplit
end