class Dizby::SpawnCommand

Constants

TEMPLATE

Attributes

config[RW]
ruby_cmd[RW]
uri[RW]

Public Class Methods

local_file(file) click to toggle source
# File lib/dizby/tunnel/spawn_command.rb, line 45
def local_file(file)
  new(File.read(file))
end
new(data, **config) click to toggle source
# File lib/dizby/tunnel/spawn_command.rb, line 12
def initialize(data, **config)
  @data = data
  @ruby_cmd = 'ruby'
  @uri = 'drb://'
  @config = config
  @mode = :static
end
remote_file(file, obj_name) click to toggle source

WARNING: Dangerous operation. This loads an object from a file on the remote machine. That file may be insecure or modified without notice.

# File lib/dizby/tunnel/spawn_command.rb, line 51
def remote_file(file, obj_name)
  new("load '#{file}'; #{obj_name}")
end
text(script) click to toggle source
# File lib/dizby/tunnel/spawn_command.rb, line 41
def text(script)
  new(script)
end

Public Instance Methods

dynamic?() click to toggle source
# File lib/dizby/tunnel/spawn_command.rb, line 24
def dynamic?
  @mode == :dynamic
end
set_dynamic_mode() click to toggle source
# File lib/dizby/tunnel/spawn_command.rb, line 20
def set_dynamic_mode
  @mode = :dynamic
end
to_cmd() click to toggle source
# File lib/dizby/tunnel/spawn_command.rb, line 30
    def to_cmd
      <<~EOF
        #{@ruby_cmd} -e "$(cat <<DIZBY
        #{format(TEMPLATE, @mode, @uri, @config.inspect, @data)}
        DIZBY
        )"
      EOF
    end
Also aliased as: to_s
to_s()
Alias for: to_cmd