Class: RoadForest::PathMatcher::MatchStep
- Inherits:
-
Object
- Object
- RoadForest::PathMatcher::MatchStep
- Defined in:
- lib/roadforest/path-matcher.rb
Instance Attribute Summary collapse
-
#after ⇒ Object
Returns the value of attribute after.
-
#before ⇒ Object
Returns the value of attribute before.
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#exact_value ⇒ Object
Returns the value of attribute exact_value.
-
#graph ⇒ Object
Returns the value of attribute graph.
-
#graph_term ⇒ Object
Returns the value of attribute graph_term.
-
#order ⇒ Object
Returns the value of attribute order.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#pattern ⇒ Object
Returns the value of attribute pattern.
-
#pattern_step ⇒ Object
Returns the value of attribute pattern_step.
-
#repeats ⇒ Object
Returns the value of attribute repeats.
-
#satified ⇒ Object
Returns the value of attribute satified.
-
#stem ⇒ Object
Returns the value of attribute stem.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #immediate_match ⇒ Object
-
#initialize {|_self| ... } ⇒ MatchStep
constructor
A new instance of MatchStep.
- #matched_statements ⇒ Object
- #open ⇒ Object
- #pretty_print_instance_variables ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ MatchStep
Returns a new instance of MatchStep.
51 52 53 54 55 56 57 58 |
# File 'lib/roadforest/path-matcher.rb', line 51 def initialize @children = nil reset yield self @satisfied ||= {} @stem ||= {} @repeats ||= {} end |
Instance Attribute Details
#after ⇒ Object
Returns the value of attribute after.
47 48 49 |
# File 'lib/roadforest/path-matcher.rb', line 47 def after @after end |
#before ⇒ Object
Returns the value of attribute before.
47 48 49 |
# File 'lib/roadforest/path-matcher.rb', line 47 def before @before end |
#children ⇒ Object (readonly)
Returns the value of attribute children.
49 50 51 |
# File 'lib/roadforest/path-matcher.rb', line 49 def children @children end |
#exact_value ⇒ Object
Returns the value of attribute exact_value.
47 48 49 |
# File 'lib/roadforest/path-matcher.rb', line 47 def exact_value @exact_value end |
#graph ⇒ Object
Returns the value of attribute graph.
43 44 45 |
# File 'lib/roadforest/path-matcher.rb', line 43 def graph @graph end |
#graph_term ⇒ Object
Returns the value of attribute graph_term.
44 45 46 |
# File 'lib/roadforest/path-matcher.rb', line 44 def graph_term @graph_term end |
#order ⇒ Object
Returns the value of attribute order.
47 48 49 |
# File 'lib/roadforest/path-matcher.rb', line 47 def order @order end |
#parent ⇒ Object
Returns the value of attribute parent.
38 39 40 |
# File 'lib/roadforest/path-matcher.rb', line 38 def parent @parent end |
#pattern ⇒ Object
Returns the value of attribute pattern.
42 43 44 |
# File 'lib/roadforest/path-matcher.rb', line 42 def pattern @pattern end |
#pattern_step ⇒ Object
Returns the value of attribute pattern_step.
45 46 47 |
# File 'lib/roadforest/path-matcher.rb', line 45 def pattern_step @pattern_step end |
#repeats ⇒ Object
Returns the value of attribute repeats.
40 41 42 |
# File 'lib/roadforest/path-matcher.rb', line 40 def repeats @repeats end |
#satified ⇒ Object
Returns the value of attribute satified.
41 42 43 |
# File 'lib/roadforest/path-matcher.rb', line 41 def satified @satified end |
#stem ⇒ Object
Returns the value of attribute stem.
39 40 41 |
# File 'lib/roadforest/path-matcher.rb', line 39 def stem @stem end |
#type ⇒ Object
Returns the value of attribute type.
47 48 49 |
# File 'lib/roadforest/path-matcher.rb', line 47 def type @type end |
Instance Method Details
#immediate_match ⇒ Object
69 70 71 |
# File 'lib/roadforest/path-matcher.rb', line 69 def immediate_match {} end |
#matched_statements ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/roadforest/path-matcher.rb', line 83 def matched_statements return {} unless accepting? @matched_statements ||= begin children.map do |child| child.matched_statements end.inject(immediate_match) do |set, matched| set.merge(matched) end end end |
#open ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/roadforest/path-matcher.rb', line 73 def open if excluded? return @children = [] end @children ||= build_children return children end |
#pretty_print_instance_variables ⇒ Object
63 64 65 66 67 |
# File 'lib/roadforest/path-matcher.rb', line 63 def pretty_print_instance_variables instance_variables.reject do |var| var == :@parent end end |
#reset ⇒ Object
60 61 |
# File 'lib/roadforest/path-matcher.rb', line 60 def reset end |