Module: Facets::ArrayShelljoin Deprecated

Included in:
Array
Defined in:
lib/standard/facets/shellwords.rb

Overview

Deprecated.

Scheduled for removal after 2027-09-30.

Facets' Array#shelljoin used to convert the array with #shellwords first, which changed Ruby's own Array#shelljoin: nested arrays were flattened and hashes became options, so structured input, such as a web request's parameters, could add arguments to a command. Ruby's version escapes each element as one argument. Facets now leaves it alone, and only warns when the old Facets version would have given a different result.

Instance Method Summary collapse

Instance Method Details

#shelljoin ⇒ Object



95
96
97
98
99
100
101
102
# File 'lib/standard/facets/shellwords.rb', line 95

def shelljoin
  if any? { |e| Hash === e || Array === e }
    warn "Facets' Array#shelljoin is deprecated. Array#shelljoin now escapes each element, " \
         "as Ruby's own does, so hashes and nested arrays are no longer turned into options. " \
         "To get those, use array.shellwords.shelljoin. It will be removed after 2027-09-30.", uplevel: 1
  end
  super
end