Sha256: 28b331efff850fbbe538001ec8bf6a6023262e872a8db2fd3ccf48d3d54fe28d
Contents?: true
Size: 601 Bytes
Versions: 3
Compression:
Stored size: 601 Bytes
Contents
# frozen_string_literal: true module Components class Example < Phlex::Component 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.instance_eval(code) end def execute(code) output = @sandbox.instance_eval(code) @t.tab("HTML Output") do render CodeBlock.new(HtmlBeautifier.beautify(output), syntax: :html) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
phlex-0.2.2 | docs/components/example.rb |
phlex-0.2.1 | docs/components/example.rb |
phlex-0.2.0 | docs/components/example.rb |