Module: ActiveStorage::HotCell::Client::ToolArguments

Defined in:
lib/active_storage/hot_cell/client/tool_arguments.rb

Overview

Turns one of those shell strings into the argv the cell splices in, split the way Rails splits it — here, in the application, so a malformed string raises against the configuration rather than arriving in the cell as a failed conversion that reads like the document's fault.

An empty setting yields nothing at all, so the request carries no key and the operation runs its default argv unchanged.

Class Method Summary collapse

Class Method Details

.payload(key, setting) ⇒ Object



29
30
31
32
# File 'lib/active_storage/hot_cell/client/tool_arguments.rb', line 29

def self.payload(key, setting)
  arguments = split(setting)
  arguments.empty? ? {} : { key => arguments }
end

.split(setting) ⇒ Object



25
26
27
# File 'lib/active_storage/hot_cell/client/tool_arguments.rb', line 25

def self.split(setting)
  Shellwords.split(setting.to_s)
end