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.
12 13 14 15 |
# File 'lib/yarrow/content/graph.rb', line 12 def initialize(graph, config) @graph = graph @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/yarrow/content/graph.rb', line 10 def config @config end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
10 11 12 |
# File 'lib/yarrow/content/graph.rb', line 10 def graph @graph end |
Class Method Details
.from_source(config) ⇒ Object
Construct a graph collected from source content files.
6 7 8 |
# File 'lib/yarrow/content/graph.rb', line 6 def self.from_source(config) new(SourceCollector.collect(config.source), config) end |
Instance Method Details
#directories ⇒ Object
List of source directories.
28 29 30 |
# File 'lib/yarrow/content/graph.rb', line 28 def directories graph.nodes(:directory) end |
#expand_pages ⇒ Object
17 18 19 20 |
# File 'lib/yarrow/content/graph.rb', line 17 def = Yarrow::Content::CollectionExpander.new .(graph) end |
#files ⇒ Object
List of source files.
23 24 25 |
# File 'lib/yarrow/content/graph.rb', line 23 def files graph.nodes(:file) end |