stimulizer 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef63a4056af8d47a2575a6b1fa341cc66f0f4c890ca2545222f939813e81c083
4
- data.tar.gz: 2b73dca03393d1ec003e8fcf34a4421bd0f3e76026e81b6f79f65de58909229b
3
+ metadata.gz: ede79e02bdfb78d4042f27f862c167c67284704c4b198bb6a0782517ebf5f779
4
+ data.tar.gz: b62f26675aa4724f34912b16817ced4f49894b799a548fa104efaf2d42deaa8c
5
5
  SHA512:
6
- metadata.gz: d9cb1aee522e337bde660667dcf52180fd1d731eb3b99af5959a624e1106883b422d84cf8df1a56c60662dca04a7224ab8bb7e37525638ccb4026dbcdb149205
7
- data.tar.gz: 0b80d55d640ea93bef07aa5ce379b42963ffc9496c031eb36a853dc4b5a63cf4c4cc6888413938cafff6210bb94d8a9ab851bf173387702be0eb8da0d1fbf170
6
+ metadata.gz: 7b1df244a9281ccf7afceef04e2be0ac128da7098f67b65788a000334752f52a7204eb6609a3e4571bf927b008364653b5bb0ce53eb1b0be9f44e09ada4206e4
7
+ data.tar.gz: 2cdd6844616929b08d1947ada11cec929d14b32b894a8299b5ae39bf7a8cb9cebc6510d59404cd9f6f37fbbfd7215ab4407fc8b1f3960000e49a5bc02303f8f3
data/CHANGELOG.md CHANGED
@@ -3,3 +3,7 @@
3
3
  ## [0.1.0] - 2022-11-03
4
4
 
5
5
  - Initial release
6
+
7
+ ## [0.2.1] - 2022-11-29
8
+
9
+ - Adds support for `outlets` in Stimulus 3.2.0
data/README.md CHANGED
@@ -49,6 +49,18 @@ Or install it yourself as:
49
49
  $ gem install stimulizer
50
50
 
51
51
  ## Usage
52
+ ### in a classic ERB View
53
+ Include the module in your ApplicationController (or individual controllers):
54
+
55
+ ```ruby
56
+ class ApplicationController < ActionController::Base
57
+ include Stimulizer
58
+ helper_method :stimulus
59
+ # ...
60
+ ```
61
+ NOTE that you have to add `helper_method :stimulus` to ensure the view templates can use the `stimulus` method.
62
+
63
+ ### in a ViewComponent
52
64
  Include this in your class:
53
65
 
54
66
  ```ruby
@@ -88,6 +100,9 @@ Render the stimulusjs data strings into your template...
88
100
 
89
101
  <!-- supports the 'params' feature -->
90
102
  <%= stimulus(params: {foo: "bar", this_thing: "whatever"})
103
+
104
+ <!-- supports the 'outlets' feature -->
105
+ <%= stimulus(outlets: {foo: ".my-class", bar: "#widget"})
91
106
  ```
92
107
  ... or combine them:
93
108
  ```
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stimulizer
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
data/lib/stimulizer.rb CHANGED
@@ -49,13 +49,12 @@ module Stimulizer
49
49
  output = stimulus_hash(*args)
50
50
  return output if _stimulizer_opts[:output] == :hash
51
51
 
52
- raw(
53
- output.to_a
54
- .map { |k, v| %(#{k.to_s.strip}="#{v.to_s.strip}") }
55
- .join(" ")
56
- .squish
57
- .strip
58
- )
52
+ output.to_a
53
+ .map { |k, v| %(#{k.to_s.strip}="#{v.to_s.strip}") }
54
+ .join(" ")
55
+ .squish
56
+ .strip
57
+ .html_safe
59
58
  end
60
59
 
61
60
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt E Patterson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-29 00:00:00.000000000 Z
11
+ date: 2023-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable