Class: NeoScout::Scout
- Inherits:
-
Object
- Object
- NeoScout::Scout
- Defined in:
- lib/neoscout/scout.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#iterator ⇒ Object
readonly
Returns the value of attribute iterator.
-
#typer ⇒ Object
readonly
Returns the value of attribute typer.
-
#verifier ⇒ Object
readonly
Returns the value of attribute verifier.
Instance Method Summary collapse
- #checked_edge_type?(edge_type) ⇒ Boolean
- #checked_node_type?(node_type) ⇒ Boolean
- #count_edges(args) ⇒ Object
- #count_nodes(args) ⇒ Object
-
#initialize(args = {}) ⇒ Scout
constructor
A new instance of Scout.
- #new_counts ⇒ Object
- #prep_counts(counts) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Scout
Returns a new instance of Scout.
6 7 8 9 10 11 12 13 |
# File 'lib/neoscout/scout.rb', line 6 def initialize(args={}) @typer = args[:typer] @typer = Typer.new unless @typer @verifier = args[:verifier] @verifier = Verifier.new unless @verifier @iterator = args[:iterator] @iterator = ElementIterator.new unless @iterator end |
Instance Attribute Details
#iterator ⇒ Object (readonly)
Returns the value of attribute iterator.
4 5 6 |
# File 'lib/neoscout/scout.rb', line 4 def iterator @iterator end |
#typer ⇒ Object (readonly)
Returns the value of attribute typer.
4 5 6 |
# File 'lib/neoscout/scout.rb', line 4 def typer @typer end |
#verifier ⇒ Object (readonly)
Returns the value of attribute verifier.
4 5 6 |
# File 'lib/neoscout/scout.rb', line 4 def verifier @verifier end |
Instance Method Details
#checked_edge_type?(edge_type) ⇒ Boolean
19 20 21 |
# File 'lib/neoscout/scout.rb', line 19 def checked_edge_type?(edge_type) @typer.checked_edge_type?(edge_type) && @verifier.checked_edge_type?(edge_type) end |
#checked_node_type?(node_type) ⇒ Boolean
15 16 17 |
# File 'lib/neoscout/scout.rb', line 15 def checked_node_type?(node_type) @typer.checked_node_type?(node_type) && @verifier.checked_node_type?(node_type) end |
#count_edges(args) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/neoscout/scout.rb', line 43 def count_edges(args) counts = prep_counts(args[:counts]) @iterator.iter_edges(args) do |edge| begin edge_type = @typer.edge_type(edge) edge_ok = process_edge(counts, edge_type, edge) counts.count_edge(edge_type, edge_ok) rescue Exception => e puts e counts.count_edge(e.class.to_s, false) end end counts end |
#count_nodes(args) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/neoscout/scout.rb', line 28 def count_nodes(args) counts = prep_counts(args[:counts]) @iterator.iter_nodes(args) do |node| begin node_type = @typer.node_type(node) node_ok = process_node(counts, node_type, node) counts.count_node(node_type, node_ok) rescue Exception => e puts e counts.count_node(e.class.to_s, false) end end counts end |
#new_counts ⇒ Object
24 25 26 |
# File 'lib/neoscout/scout.rb', line 24 def new_counts NeoScout::Counts.new(typer) end |
#prep_counts(counts) ⇒ Object
58 |
# File 'lib/neoscout/scout.rb', line 58 def prep_counts(counts) ; counts end |