composable-form 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/composable/form/command.rb +54 -0
- data/lib/composable/form/gem_version.rb +1 -1
- data/lib/composable/form.rb +2 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efeb65c7ed0b26275f1972abb1fe31cc97523ecbdaeba71f281722af7078c788
|
4
|
+
data.tar.gz: 60eb6dc89bf4b0d52ba8537ff1392a2d7c91ddec63dbf28162c860fe0e9cc8b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afa237c8a016ea856d425835814d925db44cbac4b230127e897e21033c2f5d8bcf5b3deeafc82787fd2858bd97c4df9baa03f592f09e29618fec949918473cb8
|
7
|
+
data.tar.gz: b1465fc19ee336e4a9ab848bb82b9df1ab8d173372063a12202496c6bbbed44a37e113fbc1add3195b1c9698fdcec078c81f790022e051de9c42c4f90c3d5c7d
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Composable
|
4
|
+
module Form
|
5
|
+
class Command
|
6
|
+
extend ActiveModel::Naming
|
7
|
+
|
8
|
+
include Core::AttributeDSL
|
9
|
+
include Core::ComposableDSL
|
10
|
+
include Core::Callbacks
|
11
|
+
include ActiveModel::Conversion
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def inherited(subclass)
|
15
|
+
super
|
16
|
+
subclass.prepend(Core::Command)
|
17
|
+
end
|
18
|
+
|
19
|
+
def composable(attribute, model: nil, **options, &block)
|
20
|
+
super(attribute, **options, &block)
|
21
|
+
|
22
|
+
return unless model
|
23
|
+
|
24
|
+
define_singleton_method(:model_name) do
|
25
|
+
ActiveModel::Name.new(model)
|
26
|
+
end
|
27
|
+
|
28
|
+
delegate :id, :persisted?, :new_record?, to: attribute.to_sym, allow_nil: true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def call
|
33
|
+
return unless valid?
|
34
|
+
|
35
|
+
run_callbacks :save do
|
36
|
+
save_composables { save }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def persisted?
|
41
|
+
false
|
42
|
+
end
|
43
|
+
|
44
|
+
def new_record?
|
45
|
+
true
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def save
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/composable/form.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: composable-form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jairo Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: composable-core
|
@@ -16,15 +16,15 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.
|
19
|
+
version: 0.0.5
|
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.0.
|
27
|
-
description: Form composable object to work with
|
26
|
+
version: 0.0.5
|
27
|
+
description: Form composable object to work with Rails ActionView forms
|
28
28
|
email:
|
29
29
|
- jairovm20@gmail.com
|
30
30
|
executables: []
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- LICENSE.txt
|
36
36
|
- README.md
|
37
37
|
- lib/composable/form.rb
|
38
|
+
- lib/composable/form/command.rb
|
38
39
|
- lib/composable/form/gem_version.rb
|
39
40
|
- lib/composable/form/version.rb
|
40
41
|
homepage: https://github.com/jairovm/composables
|
@@ -59,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '0'
|
61
62
|
requirements: []
|
62
|
-
rubygems_version: 3.
|
63
|
+
rubygems_version: 3.3.3
|
63
64
|
signing_key:
|
64
65
|
specification_version: 4
|
65
66
|
summary: Form Composable Object
|