Module | OpenWFE::ExpressionStorageBase |
In: |
lib/openwfe/expool/expstorage.rb
|
This module contains the observe_expool method which binds the storage to the expression pool. It also features a to_s method for the expression storages including it.
Returns true if the given expression is in the list of included classes or false if it‘s in the list of excluded classes…
include_classes has precedence of exclude_classes.
# File lib/openwfe/expool/expstorage.rb, line 158 158: def class_accepted? (fexp, include_classes, exclude_classes) 159: 160: return false if include_classes and (not include_classes.find do |klazz| 161: fexp.is_a?(klazz) 162: end) 163: return false if exclude_classes and exclude_classes.find do |klazz| 164: fexp.is_a?(klazz) 165: end 166: 167: true 168: end
This method is used by the various implementations of find_expressions()
# File lib/openwfe/expool/expstorage.rb, line 102 102: def does_match? (options, fexp_or_fei) 103: 104: wfid = options[:wfid] 105: wfid_prefix = options[:wfid_prefix] 106: parent_wfid = options[:parent_wfid] 107: 108: wfname = options[:wfname] 109: wfrevision = options[:wfrevision] 110: 111: ic = options[:include_classes] 112: ec = options[:exclude_classes] 113: ic = Array(ic) if ic 114: ec = Array(ec) if ec 115: 116: cs = options[:consider_subprocesses] 117: 118: ap = options[:applied] 119: 120: fexp, fei = if fexp_or_fei.is_a?(FlowExpressionId) 121: [ nil, fexp_or_fei ] 122: else 123: [ fexp_or_fei, fexp_or_fei.fei ] 124: end 125: 126: # 127: # let's make it verbose... 128: 129: if fexp 130: return false if (ap == true and not fexp.apply_time) 131: return false if (ap == false and fexp.apply_time) 132: return false unless class_accepted?(fexp, ic, ec) 133: end 134: 135: return false \ 136: if wfname and fei.wfname != wfname 137: return false \ 138: if wfrevision and fei.wfrevision != wfrevision 139: 140: return false \ 141: if cs and fei.sub_instance_id != "" 142: return false \ 143: if wfid and fei.wfid != wfid 144: return false \ 145: if wfid_prefix and not fei.wfid.match("^#{wfid_prefix}") 146: return false \ 147: if parent_wfid and not fei.parent_wfid == parent_wfid 148: 149: true 150: end
# File lib/openwfe/expool/expstorage.rb, line 60 60: def observe_expool 61: 62: get_expression_pool.add_observer(:update) do |channel, fei, fe| 63: ldebug { ":update for #{fei}" } 64: self[fei] = fe 65: end 66: get_expression_pool.add_observer(:remove) do |channel, fei| 67: ldebug { ":delete for #{fei}" } 68: self.delete fei 69: end 70: end
a human readable representation of the content of the expression storage.
Warning : this will display the content of the real storage, (especially when called against a cache).
# File lib/openwfe/expool/expstorage.rb, line 79 79: def to_s 80: 81: s = "\n\n==== #{self.class} ====" 82: 83: find_expressions.each do |fexp| 84: 85: s << "\n" 86: if fexp.kind_of?(RawExpression) 87: s << "*raw" 88: else 89: s << " " 90: end 91: s << fexp.fei.to_s 92: end 93: s << "\n==== . ====\n" 94: 95: s 96: end