Class: Yarrow::Content::Graph
- Inherits:
-
Object
- Object
- Yarrow::Content::Graph
- Defined in:
- lib/yarrow/content/graph.rb
Overview
A directed graph of every element of content in the project.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
Class Method Summary collapse
-
.from_source(config) ⇒ Object
Construct a graph collected from source content files.
Instance Method Summary collapse
-
#directories ⇒ Object
List of source directories.
- #expand_pages ⇒ Object
-
#files ⇒ Object
List of source files.
-
#initialize(graph, config) ⇒ Graph
constructor
A new instance of Graph.
Constructor Details
#initialize(graph, config) ⇒ Graph
Returns a new instance of Graph.
37 38 39 40 |
# File 'lib/yarrow/content/graph.rb', line 37 def initialize(graph, config) @graph = graph @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
35 36 37 |
# File 'lib/yarrow/content/graph.rb', line 35 def config @config end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
35 36 37 |
# File 'lib/yarrow/content/graph.rb', line 35 def graph @graph end |
Class Method Details
.from_source(config) ⇒ Object
Construct a graph collected from source content files.
31 32 33 |
# File 'lib/yarrow/content/graph.rb', line 31 def self.from_source(config) new(SourceCollector.collect(config.input_dir), config) end |
Instance Method Details
#directories ⇒ Object
List of source directories.
53 54 55 |
# File 'lib/yarrow/content/graph.rb', line 53 def directories graph.nodes(:directory) end |
#expand_pages ⇒ Object
42 43 44 45 |
# File 'lib/yarrow/content/graph.rb', line 42 def = Yarrow::Content::CollectionExpander.new(config.content_types) .(graph) end |
#files ⇒ Object
List of source files.
48 49 50 |
# File 'lib/yarrow/content/graph.rb', line 48 def files graph.nodes(:file) end |