Sha256: 734e4c387f2b5957a18eead81004292ee304987e042566e4f252f83b3ff5c708
Contents?: true
Size: 529 Bytes
Versions: 1
Compression:
Stored size: 529 Bytes
Contents
# frozen_string_literal: true module Components class Example < Phlex::View def initialize @sandbox = Module.new end def template(&block) render Tabs.new do |t| @t = t yield self end end def tab(name, code) @t.tab(name) do render CodeBlock.new(code, syntax: :ruby) end @sandbox.class_eval(code) end def execute(code) output = @sandbox.class_eval(code) @t.tab("👀 Output") do render CodeBlock.new(HtmlBeautifier.beautify(output), syntax: :html) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
phlex-0.4.0 | docs/components/example.rb |