Sha256: 164ed0903326fa02b356da72383b7581ab4dc8efec3a4912633b7eacb3a1bed9
Contents?: true
Size: 724 Bytes
Versions: 28
Compression:
Stored size: 724 Bytes
Contents
# frozen_string_literal: true module ActiveElement module Components # Outputs a `<script>` tag and sets globally-available JSON data, available as `ActiveElement.jsonData.<key>`. # Note key is camelized, so `foo_bar_baz` becomes `fooBarBaz`. class Json def initialize(controller, object:, key:) @controller = controller @object = object @key = key end def template 'active_element/components/json' end def locals { controller: controller, object: object, key: ActiveElement::Components::Util.json_name(key) } end private attr_reader :controller, :object, :key end end end
Version data entries
28 entries across 28 versions & 1 rubygems