docs/components/code_block.rb in phlex-0.2.2 vs docs/components/code_block.rb in phlex-0.3.0

- old
+ new

@@ -1,26 +1,26 @@ # frozen_string_literal: true module Components - class CodeBlock < Phlex::Component - FORMATTER = Rouge::Formatters::HTML.new + class CodeBlock < Phlex::View + FORMATTER = Rouge::Formatters::HTML.new - def initialize(code, syntax:) - @code = code - @syntax = syntax - end + def initialize(code, syntax:) + @code = code + @syntax = syntax + end - def template - pre(class: "highlight p-5 whitespace-pre-wrap bg-stone-50") { - raw FORMATTER.format( - lexer.lex(@code) - ) - } - end + def template + pre(class: "highlight p-5 whitespace-pre-wrap bg-stone-50") { + raw FORMATTER.format( + lexer.lex(@code) + ) + } + end - private + private - def lexer - Rouge::Lexer.find(@syntax) - end - end + def lexer + Rouge::Lexer.find(@syntax) + end + end end