futurism 0.4.1 → 0.6.0

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: dc887b3a3173cce8feec82e572327f820cdb39793b5ee5fd5977b6e32c1edb78
4
- data.tar.gz: e0f429c1861f30754e91c3dcce1121bf95894f558792f15f7f72958006b01dea
3
+ metadata.gz: e784a06ccd2401b46d5a8a0cffd44e194e3a69db8c10439a7bb1eb0a7cfcf3d8
4
+ data.tar.gz: 763001a24e053f55745e7560ce0fe446256328a01c758efaa4a3eb65424cd40e
5
5
  SHA512:
6
- metadata.gz: 603a65c0d08974feeaceb867e076ab69daf99e51a139fd8f9c2634d7e3b885a7f662ae1c2c32e0e2c31ec6e2dd1b55ec2df8ad385441abfe25d66a7088d30a21
7
- data.tar.gz: 11d930242efc8ff82a7b495197b4c5fceb9a0a7cc4e89fc48d9464e05e85e7eb307b7a25dac85628e2a5f7e66e1427e960150f544b325552142fc1ececb5e7db
6
+ metadata.gz: 1486c1e9d54f3e380c675f1fb5f79ec9dc4753446209dae14bbef9a15600f1635d81b0fd75415067019efd5c4b3df6110785da951ef4cc5076d5b9ae13febffc
7
+ data.tar.gz: d68ab7a3c7909206e92644b2d7b3e227ddf2e4d5d0c7d787bffbc9766dc48115bb785bd923aecf5dc64244a74dd419bc930148968ff72c827f3bf21d9c199031
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Futurism
2
2
  [![Twitter follow](https://img.shields.io/twitter/follow/julian_rubisch?style=social)](https://twitter.com/julian_rubisch)
3
3
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
4
- [![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors-)
4
+ [![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-)
5
5
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
6
6
  Lazy-load Rails partials via CableReady
7
7
 
@@ -20,10 +20,12 @@ Lazy-load Rails partials via CableReady
20
20
  - [Resource](#resource)
21
21
  - [Explicit Partial](#explicit-partial)
22
22
  - [HTML Options](#html-options)
23
+ - [Eager Loading](#eager-loading)
23
24
  - [Events](#events)
24
25
  - [Installation](#installation)
25
26
  - [Manual Installation](#manual-installation)
26
27
  - [Authentication](#authentication)
28
+ - [Testing](#testing)
27
29
  - [Gotchas](#gotchas)
28
30
  - [Contributing](#contributing)
29
31
  - [License](#license)
@@ -122,6 +124,22 @@ Collection rendering is also possible:
122
124
  <% end %>
123
125
  ```
124
126
 
127
+ #### Specifying Controller to Render
128
+
129
+ You can also pass in the controller that will be used to render the partial.
130
+
131
+ ```erb
132
+ <%= futurize partial: "items/card", collection: @cards, controller: MyController, extends: :div do %>
133
+ <div class="spinner"></div>
134
+ <% end %>
135
+ ```
136
+
137
+ By default (i.e. not passing in a value), futurize will use `ApplicationController`, but you may override by setting the Futurism default controller in an initializer, for example `config/initializers/futurism.rb`.
138
+
139
+ ```ruby
140
+ Futurism.default_controller = MyController
141
+ ```
142
+
125
143
  ### HTML Options
126
144
 
127
145
  You can pass a hash of attribute/value pairs which will be mixed into the HTML markup for the placeholder element. This is important for layouts that require elements to have dimensionality. For example, many scripts calculate size based on element height and width. This option ensures that your elements have integrity, even if they are gone before you see them.
@@ -140,6 +158,19 @@ This will output the following:
140
158
  </tr>
141
159
  ```
142
160
 
161
+ ### Eager Loading
162
+ It may sound surprising to support eager loading in a lazy loading library :joy:, but there's a quite simple use case:
163
+
164
+ Suppose you have some hidden interactive portion of your page, like a tab or dropdown. You don't want its content to block the initial page load, but once that is done, you occasionally don't want to wait for the element to become visible and trigger the `IntersectionObserver`, you want to lazy load its contents right after it's added to the DOM.
165
+
166
+ Futurism makes that dead simple:
167
+
168
+ ```erb
169
+ <%= futurize 'some_tab', eager: true, extends: :tr do %>
170
+ <div class="placeholder"</td>
171
+ <% end %>
172
+ ```
173
+
143
174
  ## Events
144
175
 
145
176
  Once your futurize element has been rendered, the `futurize:appeared` custom event will be called.
@@ -199,6 +230,15 @@ end
199
230
 
200
231
  The [Stimulus Reflex Docs](https://docs.stimulusreflex.com/authentication) have an excellent section about all sorts of authentication.
201
232
 
233
+ ## Testing
234
+ In Rails system tests there is a chance that flaky errors will occur due to Capybara not waiting for the placeholder elements to be replaced. To overcome this, add the flag
235
+
236
+ ```ruby
237
+ Futurism.skip_in_test = true
238
+ ```
239
+
240
+ to an initializer, for example `config/initializers/futurism.rb`.
241
+
202
242
  ## Gotchas
203
243
 
204
244
  ### ActiveStorage URLs aren't correct in development
@@ -217,6 +257,39 @@ to your environments.
217
257
 
218
258
  ## Contributing
219
259
 
260
+ ### Get local environment setup
261
+
262
+ Below are a set of instructions that may help you get a local development environment working
263
+
264
+ ```shell
265
+ # Get the gem/npm package source locally
266
+ git clone futurism
267
+ cd futurism/javascript
268
+ yarn install # install all of the npm package's dependencies
269
+ yarn link # set the local machine's futurism npm package's lookup to this local path
270
+
271
+ # Setup a sample project, use the information below directly or use your own project
272
+ git clone https://github.com/leastbad/stimulus_reflex_harness.git
273
+ cd stimulus_reflex_harness
274
+ git checkout futurism
275
+ # Edit Gemfile to point point to local gem (e.g. `gem "futurism", path: "../futurism"`)
276
+ # yarn link @minthesize/futurism
277
+
278
+
279
+ # Do your work, Submit PR, Profit!
280
+
281
+
282
+ # To stop using your local version of futurism
283
+ # change your Gemfile back to the published (e.g. `gem "futurism"`)
284
+ cd path/to/futurism/javascript
285
+ # Stop using the local npm package
286
+ yarn unlink
287
+
288
+ # Instruct your project to reinstall the published version of the npm package
289
+ cd path/to/project
290
+ yarn install --force
291
+ ```
292
+
220
293
  ## License
221
294
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
222
295
 
@@ -243,6 +316,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
243
316
  <td align="center"><a href="https://marcoroth.dev"><img src="https://avatars2.githubusercontent.com/u/6411752?v=4" width="100px;" alt=""/><br /><sub><b>Marco Roth</b></sub></a><br /><a href="https://github.com/julianrubisch/futurism/commits?author=marcoroth" title="Code">💻</a></td>
244
317
  <td align="center"><a href="https://viedit.com"><img src="https://avatars1.githubusercontent.com/u/49990587?v=4" width="100px;" alt=""/><br /><sub><b>Viedit com</b></sub></a><br /><a href="https://github.com/julianrubisch/futurism/commits?author=vieditcom" title="Documentation">📖</a></td>
245
318
  <td align="center"><a href="http://scottbarrow.ca"><img src="https://avatars2.githubusercontent.com/u/5571736?v=4" width="100px;" alt=""/><br /><sub><b>Scott Barrow</b></sub></a><br /><a href="https://github.com/julianrubisch/futurism/commits?author=scottbarrow" title="Code">💻</a></td>
319
+ <td align="center"><a href="http://domchristie.co.uk"><img src="https://avatars0.githubusercontent.com/u/111734?v=4" width="100px;" alt=""/><br /><sub><b>Dom Christie</b></sub></a><br /><a href="https://github.com/julianrubisch/futurism/pulls?q=is%3Apr+reviewed-by%3Adomchristie" title="Reviewed Pull Requests">👀</a></td>
320
+ <td align="center"><a href="http://www.rickychilcott.com"><img src="https://avatars1.githubusercontent.com/u/445759?v=4" width="100px;" alt=""/><br /><sub><b>Ricky Chilcott</b></sub></a><br /><a href="https://github.com/julianrubisch/futurism/pulls?q=is%3Apr+reviewed-by%3Arickychilcott" title="Reviewed Pull Requests">👀</a></td>
246
321
  </tr>
247
322
  </table>
248
323
 
@@ -2,6 +2,7 @@ require "rails"
2
2
  require "action_cable"
3
3
  require "cable_ready"
4
4
  require "futurism/engine"
5
+ require "futurism/message_verifier"
5
6
  require "futurism/channel"
6
7
  require "futurism/helpers"
7
8
 
@@ -10,6 +11,8 @@ module Futurism
10
11
 
11
12
  autoload :Helpers, "futurism/helpers"
12
13
 
14
+ mattr_accessor :skip_in_test, :default_controller
15
+
13
16
  ActiveSupport.on_load(:action_view) {
14
17
  include Futurism::Helpers
15
18
  }
@@ -1,5 +1,16 @@
1
+ require "rails"
2
+ require "action_cable"
3
+ require "cable_ready"
1
4
  require "futurism/engine"
5
+ require "futurism/channel"
6
+ require "futurism/helpers"
2
7
 
3
8
  module Futurism
4
- # Your code goes here...
9
+ extend ActiveSupport::Autoload
10
+
11
+ autoload :Helpers, "futurism/helpers"
12
+
13
+ ActiveSupport.on_load(:action_view) {
14
+ include Futurism::Helpers
15
+ }
5
16
  end
@@ -1,6 +1,7 @@
1
1
  module Futurism
2
2
  class Channel < ActionCable::Channel::Base
3
3
  include CableReady::Broadcaster
4
+ include Futurism::MessageVerifier
4
5
 
5
6
  def stream_name
6
7
  ids = connection.identifiers.map { |identifier| send(identifier).try(:id) || send(identifier) }
@@ -15,17 +16,22 @@ module Futurism
15
16
  end
16
17
 
17
18
  def receive(data)
18
- resources = data.fetch_values("signed_params", "sgids") { |key| [nil] }.transpose
19
+ resources = data.fetch_values("signed_params", "sgids", "signed_controllers") { |_key| Array.new(data["signed_params"].length, nil) }.transpose
19
20
 
20
- new_env = connection.env.merge(ApplicationController.renderer.instance_variable_get(:@env))
21
- ApplicationController.renderer.instance_variable_set(:@env, new_env)
22
-
23
- resources.each do |signed_params, sgid|
21
+ resources.each do |signed_params, sgid, signed_controller|
24
22
  selector = "[data-signed-params='#{signed_params}']"
25
23
  selector << "[data-sgid='#{sgid}']" if sgid.present?
24
+
25
+ controller_lookup = ControllerLookup.from(signed_string: signed_controller)
26
+ controller_lookup.setup_env!(connection: connection)
27
+ controller = controller_lookup.controller
28
+
29
+ resource = lookup_resource(signed_params: signed_params, sgid: sgid)
30
+ html = controller.render(resource)
31
+
26
32
  cable_ready[stream_name].outer_html(
27
33
  selector: selector,
28
- html: ApplicationController.render(resource(signed_params: signed_params, sgid: sgid))
34
+ html: html
29
35
  )
30
36
  end
31
37
 
@@ -34,10 +40,48 @@ module Futurism
34
40
 
35
41
  private
36
42
 
37
- def resource(signed_params:, sgid:)
43
+ def lookup_resource(signed_params:, sgid:)
38
44
  return GlobalID::Locator.locate_signed(sgid) if sgid.present?
39
45
 
40
- Rails.application.message_verifier("futurism").verify(signed_params)
46
+ message_verifier
47
+ .verify(signed_params)
48
+ .deep_transform_values { |value| value.is_a?(String) && value.start_with?("gid://") ? GlobalID::Locator.locate(value) : value }
49
+ end
50
+
51
+ class ControllerLookup
52
+ include Futurism::MessageVerifier
53
+
54
+ def self.from(signed_string:)
55
+ new(signed_string)
56
+ end
57
+
58
+ def initialize(signed_string)
59
+ @signed_string = signed_string
60
+ end
61
+
62
+ def controller
63
+ if signed_string.present?
64
+ message_verifier
65
+ .verify(signed_string)
66
+ .to_s
67
+ .safe_constantize
68
+ else
69
+ default_controller
70
+ end
71
+ end
72
+
73
+ def setup_env!(connection:)
74
+ new_env = connection.env.merge(controller.renderer.instance_variable_get(:@env))
75
+ controller.renderer.instance_variable_set(:@env, new_env)
76
+ end
77
+
78
+ private
79
+
80
+ attr_reader :signed_string
81
+
82
+ def default_controller
83
+ Futurism.default_controller || ::ApplicationController
84
+ end
41
85
  end
42
86
  end
43
87
  end
@@ -1,23 +1,37 @@
1
1
  module Futurism
2
2
  class Channel < ActionCable::Channel::Base
3
3
  include CableReady::Broadcaster
4
+ include Futurism::MessageVerifier
5
+
6
+ def stream_name
7
+ ids = connection.identifiers.map { |identifier| send(identifier).try(:id) || send(identifier) }
8
+ [
9
+ params[:channel],
10
+ ids.select(&:present?).join(";")
11
+ ].select(&:present?).join(":")
12
+ end
4
13
 
5
14
  def subscribed
6
- stream_from "Futurism::Channel"
15
+ stream_from stream_name
7
16
  end
8
17
 
9
18
  def receive(data)
10
- resources = data.fetch_values("signed_params", "sgids") { |key| [nil] }.transpose
11
-
12
- new_env = connection.env.merge(ApplicationController.renderer.instance_variable_get(:@env))
13
- ApplicationController.renderer.instance_variable_set(:@env, new_env)
19
+ resources = data.fetch_values("signed_params", "sgids", "signed_controllers") { |_key| Array.new(data["signed_params"].length, nil) }.transpose
14
20
 
15
- resources.each do |signed_params, sgid|
21
+ resources.each do |signed_params, sgid, signed_controller|
16
22
  selector = "[data-signed-params='#{signed_params}']"
17
23
  selector << "[data-sgid='#{sgid}']" if sgid.present?
18
- cable_ready["Futurism::Channel"].outer_html(
24
+
25
+ controller_lookup = ControllerLookup.from(signed_string: signed_controller)
26
+ controller_lookup.setup(connection: connection)
27
+ controller = controller_lookup.controller
28
+
29
+ resource = lookup_resource(signed_params: signed_params, sgid: sgid)
30
+ html = controller.render(resource)
31
+
32
+ cable_ready[stream_name].outer_html(
19
33
  selector: selector,
20
- html: ApplicationController.render(resource(signed_params: signed_params, sgid: sgid))
34
+ html: html
21
35
  )
22
36
  end
23
37
 
@@ -26,10 +40,48 @@ module Futurism
26
40
 
27
41
  private
28
42
 
29
- def resource(signed_params:, sgid:)
43
+ def lookup_resource(signed_params:, sgid:)
30
44
  return GlobalID::Locator.locate_signed(sgid) if sgid.present?
31
45
 
32
- Rails.application.message_verifier("futurism").verify(signed_params)
46
+ message_verifier
47
+ .verify(signed_params)
48
+ .deep_transform_values { |value| value.is_a?(String) && value.start_with?("gid://") ? GlobalID::Locator.locate(value) : value }
49
+ end
50
+
51
+ class ControllerLookup
52
+ include Futurism::MessageVerifier
53
+
54
+ def self.from(signed_string:)
55
+ new(signed_string)
56
+ end
57
+
58
+ def initialize(signed_string)
59
+ @signed_string = signed_string
60
+ end
61
+
62
+ def controller
63
+ if signed_string.present?
64
+ message_verifier
65
+ .verify(signed_string)
66
+ .to_s
67
+ .safe_constantize
68
+ else
69
+ default_controller
70
+ end
71
+ end
72
+
73
+ def setup(connection:)
74
+ new_env = connection.env.merge(controller.renderer.instance_variable_get(:@env))
75
+ controller.renderer.instance_variable_set(:@env, new_env)
76
+ end
77
+
78
+ private
79
+
80
+ attr_reader :signed_string
81
+
82
+ def default_controller
83
+ Futurism.default_controller || ::ApplicationController
84
+ end
33
85
  end
34
86
  end
35
87
  end
@@ -1,6 +1,14 @@
1
1
  module Futurism
2
2
  module Helpers
3
3
  def futurize(records_or_string = nil, extends:, **options, &block)
4
+ if Rails.env.test? && Futurism.skip_in_test
5
+ if records_or_string.nil?
6
+ return render(**options)
7
+ else
8
+ return render(records_or_string, **options)
9
+ end
10
+ end
11
+
4
12
  placeholder = capture(&block)
5
13
 
6
14
  if records_or_string.is_a?(ActiveRecord::Base) || records_or_string.is_a?(ActiveRecord::Relation)
@@ -35,12 +43,15 @@ module Futurism
35
43
  # wraps functionality for rendering a futurism element
36
44
  class Element
37
45
  include ActionView::Helpers
46
+ include Futurism::MessageVerifier
38
47
 
39
- attr_reader :extends, :placeholder, :html_options, :data_attributes, :model, :options
48
+ attr_reader :extends, :placeholder, :html_options, :data_attributes, :model, :options, :eager, :controller
40
49
 
41
50
  def initialize(extends:, placeholder:, options:)
42
51
  @extends = extends
43
52
  @placeholder = placeholder
53
+ @eager = options.delete(:eager)
54
+ @controller = options.delete(:controller)
44
55
  @html_options = options.delete(:html_options) || {}
45
56
  @data_attributes = html_options.fetch(:data, {}).except(:sgid, :signed_params)
46
57
  @model = options.delete(:model)
@@ -50,7 +61,9 @@ module Futurism
50
61
  def dataset
51
62
  data_attributes.merge({
52
63
  signed_params: signed_params,
53
- sgid: model && model.to_sgid.to_s
64
+ sgid: model && model.to_sgid.to_s,
65
+ eager: eager.presence,
66
+ signed_controller: signed_controller
54
67
  })
55
68
  end
56
69
 
@@ -65,10 +78,24 @@ module Futurism
65
78
  end
66
79
  end
67
80
 
81
+ def transformed_options
82
+ require_relative "shims/deep_transform_values" unless options.respond_to? :deep_transform_values
83
+
84
+ options.deep_transform_values do |value|
85
+ value.is_a?(ActiveRecord::Base) && !value.new_record? ? value.to_global_id.to_s : value
86
+ end
87
+ end
88
+
68
89
  private
69
90
 
70
91
  def signed_params
71
- Rails.application.message_verifier("futurism").generate(options)
92
+ message_verifier.generate(transformed_options)
93
+ end
94
+
95
+ def signed_controller
96
+ return unless controller.present?
97
+
98
+ message_verifier.generate(controller.to_s)
72
99
  end
73
100
  end
74
101
  end
@@ -1,12 +1,22 @@
1
1
  module Futurism
2
2
  module Helpers
3
3
  def futurize(records_or_string = nil, extends:, **options, &block)
4
+ if Rails.env.test? && Futurism.skip_in_test
5
+ if records_or_string.nil?
6
+ render options
7
+ else
8
+ render records_or_string, options
9
+ end
10
+ return
11
+ end
12
+
4
13
  placeholder = capture(&block)
5
14
 
6
15
  if records_or_string.is_a?(ActiveRecord::Base) || records_or_string.is_a?(ActiveRecord::Relation)
7
16
  futurize_active_record(records_or_string, extends: extends, placeholder: placeholder, **options)
8
17
  elsif records_or_string.is_a?(String)
9
- futurize_with_options(extends: extends, placeholder: placeholder, partial: records_or_string, **options)
18
+ html_options = options.delete(:html_options)
19
+ futurize_with_options(extends: extends, placeholder: placeholder, partial: records_or_string, locals: options, html_options: html_options)
10
20
  else
11
21
  futurize_with_options(extends: extends, placeholder: placeholder, **options)
12
22
  end
@@ -35,38 +45,49 @@ module Futurism
35
45
  class Element
36
46
  include ActionView::Helpers
37
47
 
38
- attr_reader :extends, :placeholder, :html_options, :model, :options
48
+ attr_reader :extends, :placeholder, :html_options, :data_attributes, :model, :options, :eager
39
49
 
40
50
  def initialize(extends:, placeholder:, options:)
41
51
  @extends = extends
42
52
  @placeholder = placeholder
53
+ @eager = options.delete(:eager)
43
54
  @html_options = options.delete(:html_options) || {}
55
+ @data_attributes = html_options.fetch(:data, {}).except(:sgid, :signed_params)
44
56
  @model = options.delete(:model)
45
- @options = options
57
+ @options = data_attributes.any? ? options.merge(data: data_attributes) : options
46
58
  end
47
59
 
48
60
  def dataset
49
- {
61
+ data_attributes.merge({
50
62
  signed_params: signed_params,
51
- sgid: model && model.to_sgid.to_s
52
- }
63
+ sgid: model && model.to_sgid.to_s,
64
+ eager: eager.presence
65
+ })
53
66
  end
54
67
 
55
68
  def render
56
69
  case extends
57
70
  when :li
58
- content_tag :li, placeholder, {data: dataset, is: "futurism-li"}.merge(html_options)
71
+ content_tag :li, placeholder, html_options.deep_merge({data: dataset, is: "futurism-li"})
59
72
  when :tr
60
- content_tag :tr, placeholder, {data: dataset, is: "futurism-table-row"}.merge(html_options)
73
+ content_tag :tr, placeholder, html_options.deep_merge({data: dataset, is: "futurism-table-row"})
61
74
  else
62
- content_tag :"futurism-element", placeholder, {data: dataset}.merge(html_options)
75
+ content_tag :"futurism-element", placeholder, html_options.deep_merge({data: dataset})
76
+ end
77
+ end
78
+
79
+ def transformed_options
80
+ require_relative "shims/deep_transform_values" unless options.respond_to? :deep_transform_values
81
+
82
+ options.deep_transform_values do |value|
83
+ value.is_a?(ActiveRecord::Base) && !value.new_record? ? value.to_global_id.to_s : value
63
84
  end
64
85
  end
65
86
 
66
87
  private
67
88
 
68
89
  def signed_params
69
- Rails.application.message_verifier("futurism").generate(options)
90
+ Rails.application.message_verifier("futurism").generate(transformed_options)
70
91
  end
71
92
  end
72
93
  end
@@ -0,0 +1,9 @@
1
+ module Futurism
2
+ module MessageVerifier
3
+ private
4
+
5
+ def message_verifier
6
+ @message_verifier ||= Rails.application.message_verifier("futurism")
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Hash
4
+ # Returns a new hash with all values converted by the block operation.
5
+ # This includes the values from the root hash and from all
6
+ # nested hashes and arrays.
7
+ #
8
+ # hash = { person: { name: 'Rob', age: '28' } }
9
+ #
10
+ # hash.deep_transform_values{ |value| value.to_s.upcase }
11
+ # # => {person: {name: "ROB", age: "28"}}
12
+ def deep_transform_values(&block)
13
+ _deep_transform_values_in_object(self, &block)
14
+ end
15
+
16
+ # Destructively converts all values by using the block operation.
17
+ # This includes the values from the root hash and from all
18
+ # nested hashes and arrays.
19
+ def deep_transform_values!(&block)
20
+ _deep_transform_values_in_object!(self, &block)
21
+ end
22
+
23
+ private
24
+
25
+ # Support methods for deep transforming nested hashes and arrays.
26
+ def _deep_transform_values_in_object(object, &block)
27
+ case object
28
+ when Hash
29
+ object.transform_values { |value| _deep_transform_values_in_object(value, &block) }
30
+ when Array
31
+ object.map { |e| _deep_transform_values_in_object(e, &block) }
32
+ else
33
+ yield(object)
34
+ end
35
+ end
36
+
37
+ def _deep_transform_values_in_object!(object, &block)
38
+ case object
39
+ when Hash
40
+ object.transform_values! { |value| _deep_transform_values_in_object!(value, &block) }
41
+ when Array
42
+ object.map! { |e| _deep_transform_values_in_object!(e, &block) }
43
+ else
44
+ yield(object)
45
+ end
46
+ end
47
+ end
@@ -1,3 +1,3 @@
1
1
  module Futurism
2
- VERSION = "0.4.1"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: futurism
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Rubisch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-09 00:00:00.000000000 Z
11
+ date: 2020-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: appraisal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +142,14 @@ dependencies:
128
142
  requirements:
129
143
  - - ">="
130
144
  - !ruby/object:Gem::Version
131
- version: '6'
145
+ version: '5.2'
132
146
  type: :runtime
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - ">="
137
151
  - !ruby/object:Gem::Version
138
- version: '6'
152
+ version: '5.2'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: cable_ready
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -161,7 +175,6 @@ files:
161
175
  - MIT-LICENSE
162
176
  - README.md
163
177
  - Rakefile
164
- - app/assets/config/futurism_manifest.js
165
178
  - config/routes.rb
166
179
  - lib/futurism.rb
167
180
  - lib/futurism.rb~
@@ -170,6 +183,8 @@ files:
170
183
  - lib/futurism/engine.rb
171
184
  - lib/futurism/helpers.rb
172
185
  - lib/futurism/helpers.rb~
186
+ - lib/futurism/message_verifier.rb
187
+ - lib/futurism/shims/deep_transform_values.rb
173
188
  - lib/futurism/version.rb
174
189
  - lib/tasks/futurism_tasks.rake
175
190
  - lib/tasks/futurism_tasks.rake~
File without changes