formalist 0.4.1 → 0.4.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: f682b46b68f9f7eb58605a48d06c6c5e47a2963703c8424086b0533bde9cb96c
4
- data.tar.gz: ff2df0abbf4bf66a7d7225deecd6475d95f8ff395cfb4f1f6694375126eb6610
3
+ metadata.gz: 18e68963bc4183a119d9148105260e0db4013e05930135ba163aff7323bb56f1
4
+ data.tar.gz: 52981229e22c0bd7cf7bddd6f5aae1dfef9a3adf0e2ada0630184355fea74cd5
5
5
  SHA512:
6
- metadata.gz: 98f8807c4e3c289b2618643979ed0ecf4a44e41f974b732138a9e07312d2e4396d0b52433b10d9b964bfa8b418697171f7aff143460df8c5252ed2b9e1c147d7
7
- data.tar.gz: ea91a2b8c8ddb7ffe95b196e884ed3aaded8a0a3f47d3a13b5399ee819071a3dd3091bf10c0022fe74771e94a80dee6bde9290e2815461979ba4b6e6f85d7e6d
6
+ metadata.gz: 41944e8fed2c09fb7487ee42dfeaccfb77e48a63dbe8e1449da323acc7a872f531666cf1e26fbae8e8e9bc0400f5739d4cb70c2a3b76b381a580e3cceae22115
7
+ data.tar.gz: daa02bdd21dbbf6d3a185dbc571e19ff1b27439087bd8b5f45b721912e463874f40df8a7ef951e55e74dcd0caa972b329e362033a9b4bae6472688ada92f13b9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 0.4.2 / 2018-07-03
2
+
3
+ ### Fixed
4
+
5
+ - Errors passed to `#fill` are now properly stored on the form's elements
6
+
7
+ ### Changed
8
+
9
+ - Private form methods are accessible from within definition blocks
10
+
1
11
  # 0.4.1 / 2018-04-17
2
12
 
3
13
  ### Fixed
@@ -25,7 +25,7 @@ module Formalist
25
25
  def method_missing(name, *args, &block)
26
26
  if element_type?(name)
27
27
  add_element(name, *args, &block)
28
- elsif form.respond_to?(name)
28
+ elsif form.respond_to?(name, include_private = true)
29
29
  form.send(name, *args, &block)
30
30
  else
31
31
  super
@@ -35,7 +35,7 @@ module Formalist
35
35
  private
36
36
 
37
37
  def respond_to_missing?(name, _include_private = false)
38
- element_type?(name) || form.respond_to?(name)
38
+ element_type?(name) || form.respond_to?(name, _include_private = true) || super
39
39
  end
40
40
 
41
41
  def element_type?(type)
@@ -30,7 +30,7 @@ module Formalist
30
30
  }
31
31
 
32
32
  # Then run them through the schema
33
- @attributes = Types::Hash.schema(
33
+ @attributes = Types::Hash.weak(
34
34
  self.class.attributes_schema.map { |name, defn| [name, defn[:type]] }.to_h
35
35
  )[all_attributes]
36
36
 
@@ -10,9 +10,6 @@ module Formalist
10
10
  attribute :inline, Types::Bool
11
11
  attribute :validation, Types::Validation
12
12
 
13
- # @api private
14
- attr_reader :predicates
15
-
16
13
  def fill(input: {}, errors: {})
17
14
  super(
18
15
  input: input[name],
@@ -28,17 +28,17 @@ module Formalist
28
28
  @errors = errors
29
29
 
30
30
  @elements =
31
- if elements == Undefined
32
- Definition.new(self, self.class.config, &self.class.definition).elements
33
- else
34
- elements
35
- end
31
+ if elements == Undefined
32
+ Definition.new(self, self.class.config, &self.class.definition).elements
33
+ else
34
+ elements
35
+ end
36
36
 
37
37
  @dependencies = dependencies
38
38
  end
39
39
 
40
40
  def fill(input: {}, errors: {})
41
- return self if input == @input && errors = @errors
41
+ return self if input == @input && errors == @errors
42
42
 
43
43
  self.class.new(
44
44
  elements: @elements.map { |element| element.fill(input: input, errors: errors) },
@@ -1,3 +1,3 @@
1
1
  module Formalist
2
- VERSION = "0.4.1".freeze
2
+ VERSION = "0.4.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formalist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Riley
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-17 00:00:00.000000000 Z
11
+ date: 2018-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable