Module: Police::DataFlow
- Defined in:
- lib/police/dataflow.rb,
lib/police/dataflow/label.rb,
lib/police/dataflow/gating.rb,
lib/police/dataflow/proxies.rb,
lib/police/dataflow/labeling.rb,
lib/police/dataflow/proxying.rb,
lib/police/dataflow/proxy_base.rb,
lib/police/dataflow/proxy_numeric.rb
Overview
Data flow labels “track” data as it is processed in a complex system.
Defined Under Namespace
Modules: Gating, Labeling, Proxies, Proxying Classes: Label, ProxyBase, ProxyNumeric
Class Method Summary collapse
-
.label(data, label) ⇒ BasicObject
Attaches a label to a piece of data.
-
.labels(data) ⇒ Array<Police::DataFlow::Label>
All the labels attached to a piece of data.
-
.setup_gates ⇒ Object
Sets up label-propagating gates around all the native methods in the VM.
Class Method Details
.label(data, label) ⇒ BasicObject
Attaches a label to a piece of data.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/police/dataflow/labeling.rb', line 11 def self.label(data, label) label_set = data.__police_labels__ if nil == label_set proxied = data label_set = {} else proxied = data.__police_proxied__ end if Police::DataFlow::Labeling.add_label_to_set label, label_set data = Police::DataFlow::Proxying.proxy proxied, label_set end data end |
.labels(data) ⇒ Array<Police::DataFlow::Label>
All the labels attached to a piece of data.
31 32 33 34 35 36 37 38 |
# File 'lib/police/dataflow/labeling.rb', line 31 def self.labels(data) return [] unless label_set = data.__police_labels__ return label_set.first.last.keys if label_set.length == 1 labels = [] label_set.each { |label_key, label_hash| labels.concat label_hash.keys } labels end |
.setup_gates ⇒ Object
Sets up label-propagating gates around all the native methods in the VM.
This method is idempotent, so it is safe to call it multiple times.
9 10 11 |
# File 'lib/police/dataflow/gating.rb', line 9 def self.setup_gates end |