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) ⇒ Yarrow::Content::Graph
Construct a graph collected from files and directories in the configured content directory.
Instance Method Summary collapse
-
#collections ⇒ Object
List of mapped content object collections.
-
#directories ⇒ Object
List of source directories.
-
#files ⇒ Object
List of source files.
-
#initialize(graph, config) ⇒ Graph
constructor
A new instance of Graph.
-
#items ⇒ Object
List of mapped content object items.
Constructor Details
#initialize(graph, config) ⇒ Graph
Returns a new instance of Graph.
15 16 17 18 |
# File 'lib/yarrow/content/graph.rb', line 15 def initialize(graph, config) @graph = graph @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/yarrow/content/graph.rb', line 13 def config @config end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
13 14 15 |
# File 'lib/yarrow/content/graph.rb', line 13 def graph @graph end |
Class Method Details
.from_source(config) ⇒ Yarrow::Content::Graph
Construct a graph collected from files and directories in the configured content directory.
9 10 11 |
# File 'lib/yarrow/content/graph.rb', line 9 def self.from_source(config) new(Source.collect(config.source_dir), config) end |
Instance Method Details
#collections ⇒ Object
List of mapped content object collections
31 32 33 |
# File 'lib/yarrow/content/graph.rb', line 31 def collections graph.nodes(:collection) end |
#directories ⇒ Object
List of source directories.
26 27 28 |
# File 'lib/yarrow/content/graph.rb', line 26 def directories graph.nodes(:directory) end |
#files ⇒ Object
List of source files.
21 22 23 |
# File 'lib/yarrow/content/graph.rb', line 21 def files graph.nodes(:file) end |
#items ⇒ Object
List of mapped content object items
36 37 38 |
# File 'lib/yarrow/content/graph.rb', line 36 def items graph.nodes(:item) end |