class Flor::Pro::Ref

Public Instance Methods

pre_execute() click to toggle source
# File lib/flor/pcore/_ref.rb, line 7
def pre_execute

  @node['rets'] = []
end
receive_last() click to toggle source
Calls superclass method Flor::Procedure#receive_last
# File lib/flor/pcore/_ref.rb, line 12
def receive_last

  rs = @node['rets']
  rs = rs[0] if rs.size == 1 && rs[0].match(/[.\[]/)
  pa = Dense::Path.make(rs).to_a

  payload['ret'] =
    if tree[0] == '_rep'
      pa
    elsif pa.size == 2 && pa[1] == 'ret' && field?(pa)
      parent ?
        parent_node_procedure.node_payload_ret :
        node_payload_ret
    else
      lookup_value(pa)
    end

  super
end

Protected Instance Methods

field?(path) click to toggle source
# File lib/flor/pcore/_ref.rb, line 34
def field?(path)

  (s = path[0]) && s.is_a?(String) && s.match(/\Af(ld|ield)?\z/)
end
lookup_value(path) click to toggle source
Calls superclass method Flor::Node#lookup_value
# File lib/flor/pcore/_ref.rb, line 39
def lookup_value(path)

  super(path)

rescue KeyError => ke

  return nil if field?(ke.work_path)
  return nil if child_id == 1 && (n = parent_node) && n['heat0'] == '_head'
  return nil if ke.miss[1].any? && ke.miss[4].empty?
  return nil if tree[0] == '_reff'

  raise
end