Class: Flor::Pointer

Inherits:
FlorModel show all
Defined in:
lib/flor/unit/models/pointer.rb

Instance Method Summary collapse

Methods inherited from FlorModel

#data, #execution, from_h, #node, #payload, #refresh, #storage, #to_h, #unit

Instance Method Details

#att_textsObject



58
59
60
61
# File 'lib/flor/unit/models/pointer.rb', line 58

def att_texts

  attl.select { |e| e.is_a?(String) }
end

#attdObject



44
45
46
47
48
49
# File 'lib/flor/unit/models/pointer.rb', line 44

def attd

  data['atts'].inject({}) { |h, (k, v)| h[k] = v if k; h }

rescue; []
end

#attlObject



51
52
53
54
55
56
# File 'lib/flor/unit/models/pointer.rb', line 51

def attl

  data['atts'].inject([]) { |a, (k, v)| a << v if k == nil; a }

rescue; []
end

#feiObject

create_table :flor_pointers do

primary_key :id, type: :Integer
String :domain, null: false
String :exid, null: false
String :nid, null: false
String :type, null: false  # task, tasked, tag, var
String :name, null: false # task name, tasked name, tag name, var name
String :value
File :content
String :ctime, null: false

# no :status, no :mtime

index :exid
index [ :exid, :nid ]
index [ :type, :name, :value ]

String :cunit
String :munit

#unique [ :exid, :type, :name, :value ]
  # we don't care, pointers are cleaned anyway when the flow dies

end



32
# File 'lib/flor/unit/models/pointer.rb', line 32

def fei; [ exid, nid ].join('-'); end

#full_valueObject

If the pointer is a “var” pointer, returns the full value for the variable, as found in the execution’s node “0”.



37
38
39
40
41
42
# File 'lib/flor/unit/models/pointer.rb', line 37

def full_value

  return nil unless type == 'var'

  node['vars'][name]
end