Class: Marmerdo::MarkdownParser
- Inherits:
-
Object
- Object
- Marmerdo::MarkdownParser
- Defined in:
- lib/marmerdo/markdown_parser.rb
Instance Method Summary collapse
-
#initialize(path, content) ⇒ MarkdownParser
constructor
A new instance of MarkdownParser.
-
#parse ⇒ Node?
The parsed node or nil if the file has no marmerdo front matter.
Constructor Details
#initialize(path, content) ⇒ MarkdownParser
Returns a new instance of MarkdownParser.
7 8 9 10 |
# File 'lib/marmerdo/markdown_parser.rb', line 7 def initialize(path, content) @path = path @content = content end |
Instance Method Details
#parse ⇒ Node?
Returns the parsed node or nil if the file has no marmerdo front matter.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/marmerdo/markdown_parser.rb', line 13 def parse return nil unless marmerdo_file? Node.new( path: @path, name: marmerdo_matter["name"] || File.basename(@path, ".*"), namespace: marmerdo_matter["namespace"], relationships: relationships ) end |