Class: GithubToCanvasQuiz::Parser::Markdown::Base
- Inherits:
-
Object
- Object
- GithubToCanvasQuiz::Parser::Markdown::Base
- Defined in:
- lib/github_to_canvas_quiz/parser/markdown/base.rb
Instance Attribute Summary collapse
-
#frontmatter ⇒ Object
readonly
Returns the value of attribute frontmatter.
-
#markdown ⇒ Object
readonly
Returns the value of attribute markdown.
Instance Method Summary collapse
-
#initialize(markdown) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(markdown) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/github_to_canvas_quiz/parser/markdown/base.rb', line 9 def initialize(markdown) # Separate the frontmatter and the rest of the markdown content parsed = if Pathname(markdown).exist? FrontMatterParser::Parser.parse_file(markdown) else FrontMatterParser::Parser.new(:md).call(markdown) end @frontmatter = parsed.front_matter @markdown = parsed.content end |
Instance Attribute Details
#frontmatter ⇒ Object (readonly)
Returns the value of attribute frontmatter.
7 8 9 |
# File 'lib/github_to_canvas_quiz/parser/markdown/base.rb', line 7 def frontmatter @frontmatter end |
#markdown ⇒ Object (readonly)
Returns the value of attribute markdown.
7 8 9 |
# File 'lib/github_to_canvas_quiz/parser/markdown/base.rb', line 7 def markdown @markdown end |