all_futures 1.0.2 → 1.0.3

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: 58b9a9722498f608ed23c7fabc86843449339927c7bc788be45af8141ff4f7f2
4
- data.tar.gz: ee1f665dd243d05454b4d6f2d0d462fd3632d6a64d78f3cbfcbad354e0d3b083
3
+ metadata.gz: 27311f9ce52dd5cbeafae0312e8ccd79bcd59bd90c5bf92227d9132377cf63c2
4
+ data.tar.gz: c046ac9eb008984c72c053943b416243e438ab4789254bb192fced0ce269ace4
5
5
  SHA512:
6
- metadata.gz: 37c7801e9181a793516c0fc69617af28c4f9f3cfdf414ce3506cd4f3c2fbbdd0b5d891464231845c48f7abeb18dd903cdb81bf57957ed2577eb7711b45a7fbd2
7
- data.tar.gz: 383a254d75030587bf4bfef93e1cee9738ff7f96a21e91c89f5d6461d9639d77ff1fe42daa9a7ea974dbfa393a73c8d3cd9e964c498f024f75a7c0b66c70f566
6
+ metadata.gz: 5284a0ebc8318139627824a9c610912669d689266a8bca2ca88e9f4f6c0f27a1cc0cb253b6feae76711f66146089e33b45778b6a5399c74c46fddb713a61c818
7
+ data.tar.gz: 52b4c725601cff3a8f4a0ed8c90a485d730cc58dc348c3d946b33752256e005d297a14dbda7a83b16493401f96e568ce414f11a9b0b10ee54cd4b74ba45ffc0e
data/Gemfile.lock ADDED
@@ -0,0 +1,86 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ all_futures (1.0.3)
5
+ activeentity (~> 6.1)
6
+ kredis (~> 0.4)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activeentity (6.1.1)
12
+ activemodel (~> 6.0, < 7.0)
13
+ activesupport (~> 6.0, < 7.0)
14
+ activemodel (6.1.4.1)
15
+ activesupport (= 6.1.4.1)
16
+ activesupport (6.1.4.1)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 1.6, < 2)
19
+ minitest (>= 5.1)
20
+ tzinfo (~> 2.0)
21
+ zeitwerk (~> 2.3)
22
+ ast (2.4.2)
23
+ byebug (11.1.3)
24
+ coderay (1.1.3)
25
+ concurrent-ruby (1.1.9)
26
+ i18n (1.8.10)
27
+ concurrent-ruby (~> 1.0)
28
+ kredis (0.4.0)
29
+ activesupport (>= 6.0.0)
30
+ redis (~> 4.2)
31
+ magic_frozen_string_literal (1.2.0)
32
+ method_source (1.0.0)
33
+ minitest (5.14.4)
34
+ parallel (1.21.0)
35
+ parser (3.0.2.0)
36
+ ast (~> 2.4.1)
37
+ pry (0.13.1)
38
+ coderay (~> 1.1)
39
+ method_source (~> 1.0)
40
+ rainbow (3.0.0)
41
+ rake (13.0.6)
42
+ redis (4.4.0)
43
+ regexp_parser (2.1.1)
44
+ rexml (3.2.5)
45
+ rubocop (1.20.0)
46
+ parallel (~> 1.10)
47
+ parser (>= 3.0.0.0)
48
+ rainbow (>= 2.2.2, < 4.0)
49
+ regexp_parser (>= 1.8, < 3.0)
50
+ rexml
51
+ rubocop-ast (>= 1.9.1, < 2.0)
52
+ ruby-progressbar (~> 1.7)
53
+ unicode-display_width (>= 1.4.0, < 3.0)
54
+ rubocop-ast (1.11.0)
55
+ parser (>= 3.0.1.1)
56
+ rubocop-performance (1.11.5)
57
+ rubocop (>= 1.7.0, < 2.0)
58
+ rubocop-ast (>= 0.4.0)
59
+ ruby-progressbar (1.11.0)
60
+ ruby_jard (0.3.1)
61
+ byebug (>= 9.1, < 12.0)
62
+ pry (~> 0.13.0)
63
+ tty-screen (~> 0.8.1)
64
+ standard (1.3.0)
65
+ rubocop (= 1.20.0)
66
+ rubocop-performance (= 1.11.5)
67
+ standardrb (1.0.0)
68
+ standard
69
+ tty-screen (0.8.1)
70
+ tzinfo (2.0.4)
71
+ concurrent-ruby (~> 1.0)
72
+ unicode-display_width (2.1.0)
73
+ zeitwerk (2.4.2)
74
+
75
+ PLATFORMS
76
+ x86_64-linux
77
+
78
+ DEPENDENCIES
79
+ all_futures!
80
+ magic_frozen_string_literal (~> 1.2.0)
81
+ rake (~> 13.0, >= 13.0.3)
82
+ ruby_jard (~> 0.3)
83
+ standardrb (~> 1.0)
84
+
85
+ BUNDLED WITH
86
+ 2.2.20
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # All Futures
2
2
 
3
- The [all\_futures](https://github.com/leastbad/all_futures) gem offers Rails developers a way to **gather attributes** on an unsaved model **across multiple requests**. It's perfect for [StimulusReflex](https://docs.stimulusreflex.com/) users that are building faceted search interfaces, as well as [Optimism](https://optimism.leastbad.com/) users looking to implement real-time, per-attribute validation schemes.
3
+ The [all\_futures](https://github.com/leastbad/all_futures) gem offers Rails developers a way to **gather attributes** on an unsaved model **across multiple requests**.
4
+
5
+ It's perfect for [StimulusReflex](https://docs.stimulusreflex.com/) users that are building faceted search interfaces, real-time input validation and persisting the display state of low-stakes UI elements.
4
6
 
5
7
  Try a demo, here: 👉 [Beast Mode StimulusReflex](https://beastmode.leastbad.com/) 👈
6
8
 
@@ -37,10 +39,10 @@ Yes, All Futures is for **you**.
37
39
 
38
40
  ## How does All Futures work?
39
41
 
40
- First, set up an All Futures class that defines some [attributes](https://api.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html#method-i-attribute). Your class will inherit from `Possibility`, which is aptly-named.
42
+ First, set up an All Futures class that defines some [attributes](https://api.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html#method-i-attribute). Your class will inherit from `AllFutures`, which is aptly-named:
41
43
 
42
44
  ```ruby
43
- class ExampleModel < Possibility
45
+ class ExampleModel < AllFutures
44
46
  attribute :name, :string
45
47
  attribute :age, :integer, default: 21
46
48
  end
@@ -51,7 +53,7 @@ Then create an instance and assign it to an instance variable in the controller
51
53
  ```ruby
52
54
  class ExampleController < ApplicationController
53
55
  def index
54
- @af = ExampleModel.new
56
+ @filter = ExampleModel.new
55
57
  end
56
58
  end
57
59
  ```
@@ -59,8 +61,8 @@ end
59
61
  Emit the instance id as a data attribute on every element which can update your model:
60
62
 
61
63
  ```text
62
- Name: <input type="text" data-af="<%= @af.id %>" data-reflex="input->Example#name" /><br/>
63
- Age: <input type="text" data-af="<%= @af.id %>" data-reflex="input->Example#age" placeholder="<%= @id.age %>" />
64
+ Name: <input type="text" data-filter="<%= @filter.id %>" data-reflex="input->Example#name" /><br/>
65
+ Age: <input type="text" data-filter="<%= @filter.id %>" data-reflex="input->Example#age" placeholder="<%= @filter.age %>" />
64
66
  ```
65
67
 
66
68
  Since all attributes are gathered and sent to the server during a Reflex operation, it's easy to retrieve the instance id from the Reflex element accessor and use it to call up the correct All Futures object and make changes to it:
@@ -68,12 +70,12 @@ Since all attributes are gathered and sent to the server during a Reflex operati
68
70
  ```ruby
69
71
  class ExampleReflex < ApplicationReflex
70
72
  def name
71
- model = ExampleModel.find(element.dataset.af)
73
+ model = ExampleModel.find(element.dataset.filter)
72
74
  model[:name] = element.value
73
75
  end
74
-
76
+
75
77
  def age
76
- model = ExampleModel.find(element.dataset.af)
78
+ model = ExampleModel.find(element.dataset.filter)
77
79
  model[:age] = element.value
78
80
  end
79
81
  end
@@ -94,7 +96,7 @@ All Futures class attributes are persisted in Redis via the excellent [Kredis](h
94
96
  All Futures is based on [Active Entity](https://github.com/jasl/activeentity). It is similar to using [ActiveModel::Model](https://api.rubyonrails.org/classes/ActiveModel/Model.html), except that it has full support for [Attributes](https://api.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html#method-i-attribute), including arrays and nested attributes. All Futures classes behave like ActiveModel classes, so you can inspect `valid?` and the `errors` accessor.
95
97
 
96
98
  ```ruby
97
- class ExampleModel < Possibility
99
+ class ExampleModel < AllFutures
98
100
  attribute :name, :string
99
101
  validates :name, presence: true
100
102
  end
@@ -116,9 +118,9 @@ Once the state of your attributes is valid, you can pass the `attributes` from y
116
118
 
117
119
  You can experiment with [Beast Mode StimulusReflex](https://beastmode.leastbad.com/), a live demonstration of using All Futures to drill down into a tabular dataset, [**right now**](https://beastmode.leastbad.com/). 👈
118
120
 
119
- The Beast Mode [codebase](https://github.com/leastbad/beast_mode) [![GitHub stars](https://img.shields.io/github/stars/leastbad/beast_mode?style=social)](https://github.com/leastbad/beast_mode) [![GitHub forks](https://img.shields.io/github/forks/leastbad/beast_mode?style=social)](https://github.com/leastbad/beast_mode) is set up as a template repo which I recommend that you clone and experiment with.
121
+ The Beast Mode [codebase](https://github.com/leastbad/beast_mode) [![GitHub stars](https://img.shields.io/github/stars/leastbad/beast_mode?style=social)](https://github.com/leastbad/beast_mode) [![GitHub forks](https://img.shields.io/github/forks/leastbad/beast_mode?style=social)](https://github.com/leastbad/beast_mode) is set up as a **template repo** which I recommend that you clone and experiment with.
120
122
 
121
- The two key files are the [Filter](https://github.com/leastbad/beast_mode/blob/master/app/filters/customer_filter.rb) and the [Reflex](https://github.com/leastbad/beast_mode/blob/master/app/reflexes/customers_reflex.rb). You can read the tutorial post behind this example on my blog [here](https://leastbad.com/beast-mode/).
123
+ The three key files are the [Filter](https://github.com/leastbad/beast_mode/blob/master/app/filters/customer_filter.rb), the [Reflex](https://github.com/leastbad/beast_mode/blob/master/app/reflexes/customers_reflex.rb) and the [Model](https://github.com/leastbad/beast_mode/blob/master/app/models/customer.rb). You can read the tutorial post behind this example on my blog [here](https://leastbad.com/beast-mode/).
122
124
 
123
125
  Assuming you're running Ruby 2.7.3, Postgres and have Redis running on your system, you can just run `bin/setup` to install it, including migrations and the DB seed file.
124
126
 
@@ -15,7 +15,7 @@ class AllFutures < ActiveEntity::Base
15
15
  end
16
16
 
17
17
  def save
18
- Kredis.json("#{self.class.name}:#{@id}").value = self.attributes.to_json
18
+ Kredis.json("#{self.class.name}:#{@id}").value = self.attributes
19
19
  changes_applied
20
20
  end
21
21
 
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: all_futures
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - leastbad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-26 00:00:00.000000000 Z
11
+ date: 2021-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kredis
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.2'
19
+ version: '0.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.2'
26
+ version: '0.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activeentity
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -53,21 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.2.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: pry
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.12'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.12'
69
- - !ruby/object:Gem::Dependency
70
- name: pry-nav
56
+ name: ruby_jard
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - "~>"
@@ -122,6 +108,7 @@ extensions: []
122
108
  extra_rdoc_files: []
123
109
  files:
124
110
  - Gemfile
111
+ - Gemfile.lock
125
112
  - LICENSE.txt
126
113
  - README.md
127
114
  - Rakefile