Class: Notebroker::Lexer
- Inherits:
-
Object
- Object
- Notebroker::Lexer
- Extended by:
- Dry::Initializer, Callable
- Defined in:
- lib/notebroker/lexer.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/notebroker/lexer.rb', line 10 def call lines.map do |cell| case type = cell[:cell_type] when "markdown" then Cells::Markdown.new(cell[:source]) when "code" then Cells::Code.new( cell.fetch(:source, []), cell.fetch(:outputs, []) ) else fail UnknownCellType, "No handler for #{type}" end end end |