Class: Prremote::Commands::EvalCmd

Inherits:
Object
  • Object
show all
Defined in:
lib/prremote/commands/eval_cmd.rb

Instance Method Summary collapse

Constructor Details

#initialize(port:, baud:) ⇒ EvalCmd

Returns a new instance of EvalCmd.



7
8
9
10
# File 'lib/prremote/commands/eval_cmd.rb', line 7

def initialize(port:, baud:)
  @port = port
  @baud = baud
end

Instance Method Details

#call(expr) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/prremote/commands/eval_cmd.rb', line 12

def call(expr)
  tmp = Tempfile.new(['prremote_eval', '.rb'])
  tmp.write(expr)
  tmp.flush
  Run.new(port: @port, baud: @baud).call(tmp.path)
ensure
  tmp&.close!
end