class Nocode::Context

Describes the environment for each running step. An instance is initialized when a job kicks off and then is passed from step to step.

Constants

PARAMETERS_KEY
REGISTERS_KEY

Attributes

io[R]
parameters[R]
registers[R]

Public Class Methods

new(io: $stdout, parameters: {}, registers: {}) click to toggle source
# File lib/nocode/context.rb, line 14
def initialize(io: $stdout, parameters: {}, registers: {})
  @io         = io || $stdout
  @parameters = Util::Dictionary.ensure(parameters)
  @registers  = Util::Dictionary.ensure(registers)

  freeze
end

Public Instance Methods

log(msg) click to toggle source
# File lib/nocode/context.rb, line 41
def log(msg)
  io.puts(msg)
end
log_line() click to toggle source
# File lib/nocode/context.rb, line 37
def log_line
  log('-' * 50)
end
parameter(key) click to toggle source
# File lib/nocode/context.rb, line 26
def parameter(key)
  parameters[key]
end
register(key) click to toggle source
# File lib/nocode/context.rb, line 22
def register(key)
  registers[key]
end
to_h() click to toggle source
# File lib/nocode/context.rb, line 30
def to_h
  {
    REGISTERS_KEY => registers,
    PARAMETERS_KEY => parameters
  }
end