Class: Nodepile::PileOrganizer::RuleCache
- Inherits:
-
Object
- Object
- Nodepile::PileOrganizer::RuleCache
- Defined in:
- lib/nodepile/pile_organizer.rb,
lib/nodepile/pile_organizer.rb
Overview
Represents cached information about a single specific rule
Instance Method Summary collapse
- #eval_using(kaa) ⇒ Object
-
#initialize(rule_erec) ⇒ RuleCache
constructor
A new instance of RuleCache.
- #inspect ⇒ Object
- #is_implied ⇒ Object
- #key ⇒ Object
- #match?(kaa) ⇒ Boolean
- #relevant_entity_type ⇒ Object
- #type ⇒ Object
-
#uses_dynamic_match? ⇒ Boolean
Note that a rule that uses dynamic matching cannot precalculate which records it matches and must (to be safe) reclculate the match in response to any changes.
Constructor Details
#initialize(rule_erec) ⇒ RuleCache
Returns a new instance of RuleCache.
225 226 227 228 229 230 |
# File 'lib/nodepile/pile_organizer.rb', line 225 def initialize(rule_erec) @er = rule_erec.freeze #just for to avoid casual alteration raise "Only ERecs of type :rule may be stored in this structure" unless self.type == :rule @verifiers = [*self.key].map{|s| Nodepile::InputColumnSpecs.make_pattern_match_verifier(s)} @rule_eval = RuleRecordEvaluator.new(@er) end |
Instance Method Details
#eval_using(kaa) ⇒ Object
248 |
# File 'lib/nodepile/pile_organizer.rb', line 248 def eval_using(kaa) = @rule_eval.calculate_rule(kaa) |
#inspect ⇒ Object
232 233 234 |
# File 'lib/nodepile/pile_organizer.rb', line 232 def inspect "#<#{self.class}:0x#{object_id} key=#{self.key.inspect} > " end |
#is_implied ⇒ Object
237 |
# File 'lib/nodepile/pile_organizer.rb', line 237 def is_implied = @er['@is_implied'] |
#key ⇒ Object
238 |
# File 'lib/nodepile/pile_organizer.rb', line 238 def key = @er['@key'] |
#match?(kaa) ⇒ Boolean
247 |
# File 'lib/nodepile/pile_organizer.rb', line 247 def match?(kaa) = @rule_eval.match_record?(kaa) |
#relevant_entity_type ⇒ Object
251 |
# File 'lib/nodepile/pile_organizer.rb', line 251 def relevant_entity_type = @er['@key'].is_a?(String) ? :node : :edge |
#type ⇒ Object
236 |
# File 'lib/nodepile/pile_organizer.rb', line 236 def type = @er['@type'] |
#uses_dynamic_match? ⇒ Boolean
Note that a rule that uses dynamic matching cannot precalculate which records it matches and must (to be safe) reclculate the match in response to any changes
243 |
# File 'lib/nodepile/pile_organizer.rb', line 243 def uses_dynamic_match? = @rule_eval.uses_dynamic_match? |