Class: ElmInstall::GraphBuilder
- Inherits:
-
Object
- Object
- ElmInstall::GraphBuilder
- Defined in:
- lib/elm_install/graph_builder.rb
Overview
This class is for building dependency graphs from a cache.
Instance Attribute Summary collapse
-
#graph ⇒ Solve::Graph
readonly
The graph.
Class Method Summary collapse
-
.graph_from_cache(cache, options = { verbose: false }) ⇒ Solve::Graph
Returns a graph from a cache and options.
Instance Method Summary collapse
-
#build ⇒ void
Builds the graph.
-
#initialize(cache, options = { verbose: false }) ⇒ GraphBuilder
constructor
Initialies a graph build with a cache and options.
Constructor Details
#initialize(cache, options = { verbose: false }) ⇒ GraphBuilder
Initialies a graph build with a cache and options.
23 24 25 26 27 |
# File 'lib/elm_install/graph_builder.rb', line 23 def initialize(cache, = { verbose: false }) @graph = Solve::Graph.new @options = @cache = cache end |
Instance Attribute Details
#graph ⇒ Solve::Graph (readonly)
Returns The graph.
5 6 7 |
# File 'lib/elm_install/graph_builder.rb', line 5 def graph @graph end |
Class Method Details
.graph_from_cache(cache, options = { verbose: false }) ⇒ Solve::Graph
Returns a graph from a cache and options.
13 14 15 16 17 |
# File 'lib/elm_install/graph_builder.rb', line 13 def self.graph_from_cache(cache, = { verbose: false }) graph = new cache, graph.build graph.graph end |
Instance Method Details
#build ⇒ void
This method returns an undefined value.
Builds the graph.
32 33 34 35 36 |
# File 'lib/elm_install/graph_builder.rb', line 32 def build @cache.each do |package, versions| add_versions package, versions end end |