Module: Funicular::Helpers::PicorubyHelper
- Defined in:
- lib/funicular/helpers/picoruby_helper.rb
Overview
View helpers exposed to ActionView through Funicular::Railtie.
Constant Summary collapse
- CDN_URL_TEMPLATE =
"https://cdn.jsdelivr.net/npm/@picoruby/wasm-wasi@%<version>s/dist/init.iife.js"- LOCAL_PATHS =
{ local_debug: "/picoruby/debug/init.iife.js", local_dist: "/picoruby/dist/init.iife.js" }.freeze
Instance Method Summary collapse
-
#picoruby_include_tag(source: nil, **options) ⇒ Object
Renders a <script> tag that bootstraps PicoRuby.wasm.
Instance Method Details
#picoruby_include_tag(source: nil, **options) ⇒ Object
Renders a <script> tag that bootstraps PicoRuby.wasm.
The source is determined by Funicular.configuration based on the current Rails environment, but can be overridden per call:
<%= picoruby_include_tag %>
<%= picoruby_include_tag source: :cdn %>
<%= picoruby_include_tag source: :local_dist, defer: true %>
Any extra options are passed straight through as HTML attributes.
24 25 26 27 28 |
# File 'lib/funicular/helpers/picoruby_helper.rb', line 24 def picoruby_include_tag(source: nil, **) resolved_source = source ? source.to_sym : Funicular.configuration.source_for(Rails.env) src = picoruby_src_for(resolved_source) tag.script("", src: src, **) end |