Class: BlastRadius::DependencyTree
- Inherits:
-
Object
- Object
- BlastRadius::DependencyTree
- Defined in:
- lib/blast_radius/dependency_tree.rb
Instance Method Summary collapse
-
#build(root_model, options = {}) ⇒ Node
Build dependency tree from a root model.
-
#initialize(configuration = nil) ⇒ DependencyTree
constructor
A new instance of DependencyTree.
Constructor Details
#initialize(configuration = nil) ⇒ DependencyTree
Returns a new instance of DependencyTree.
5 6 7 8 |
# File 'lib/blast_radius/dependency_tree.rb', line 5 def initialize(configuration = nil) @configuration = configuration || BlastRadius.configuration @analyzer = Analyzer.new end |
Instance Method Details
#build(root_model, options = {}) ⇒ Node
Build dependency tree from a root model
18 19 20 21 22 23 24 25 26 |
# File 'lib/blast_radius/dependency_tree.rb', line 18 def build(root_model, = {}) max_depth = [:max_depth] || @configuration.max_depth include_nullify = .fetch(:include_nullify, @configuration.include_nullify) include_restrict = .fetch(:include_restrict, @configuration.include_restrict) root_node = Node.new(root_model, depth: 0) build_tree(root_node, max_depth, include_nullify, include_restrict) root_node end |