formalist 0.1.0 → 0.2.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
  SHA1:
3
- metadata.gz: 372c76aa3a3991513336c9b742aa6c5fd3d45b9b
4
- data.tar.gz: 44cf4056ec9617c63d2ae9829bbed28013977e2d
3
+ metadata.gz: 80737e639f603683df1a3527b2a1978591169aa0
4
+ data.tar.gz: db8cc08289a1b651ee40f763245b5a917a08b6f2
5
5
  SHA512:
6
- metadata.gz: b72e88f632bb792ac8b6356020215968013cfd1b4370f03f5fd78e527c996b71d143ec6470a67be3a2eb1077d5be49ff67bbd4e822ece0a483c20f203c9c49d6
7
- data.tar.gz: 5420b73a92b48894ddd9ff798b11c334bd4d728e9281ca16f17b031e22833e122da5d6cac520d59ee9c542a90d35c96cdd55eba2e58a803cba2c7bd50c419a36
6
+ metadata.gz: ca4062cdf2586ed0d562ae40e8163542453180fcf35d9310ae72c5eb050ee70a62110d972e25474be9644547dc475b0718d740a477fee965daca92b7e6866726
7
+ data.tar.gz: 45c7fe326a700e1afe77207438bb9e6b400687516a8229d25a6d981e290e211b493f93ca62ef1a72b8bc20951dd43abcd885c298973f1348f38d8952f11cf39d
data/Gemfile CHANGED
@@ -3,6 +3,9 @@ source "https://rubygems.org"
3
3
  # Gem dependencies are specified in formalist.gemspec
4
4
  gemspec
5
5
 
6
+ # Lock to a version of dry-v that'll offer the AST/error message structures we expect
7
+ gem "dry-validation", git: "https://github.com/dryrb/dry-validation", ref: "6447302f3b53766b29f29230831890a5cc3822e0"
8
+
6
9
  group :tools do
7
10
  gem "pry"
8
11
  end
@@ -1,11 +1,23 @@
1
+ GIT
2
+ remote: https://github.com/dryrb/dry-validation
3
+ revision: 6447302f3b53766b29f29230831890a5cc3822e0
4
+ ref: 6447302f3b53766b29f29230831890a5cc3822e0
5
+ specs:
6
+ dry-validation (0.6.0)
7
+ dry-configurable (~> 0.1, >= 0.1.3)
8
+ dry-container (~> 0.2, >= 0.2.8)
9
+ dry-data (~> 0.5, >= 0.5.0)
10
+ dry-equalizer (~> 0.2)
11
+ dry-logic (~> 0.1, >= 0.1.4)
12
+
1
13
  PATH
2
14
  remote: .
3
15
  specs:
4
- formalist (0.1.0)
16
+ formalist (0.2.0)
5
17
  dry-configurable
6
18
  dry-container
7
19
  dry-data (>= 0.4.2)
8
- dry-validation
20
+ dry-validation (~> 0.6.0)
9
21
  inflecto
10
22
 
11
23
  GEM
@@ -18,23 +30,22 @@ GEM
18
30
  coderay (1.1.0)
19
31
  diff-lcs (1.2.5)
20
32
  docile (1.1.5)
21
- dry-configurable (0.1.2)
33
+ dry-configurable (0.1.3)
22
34
  thread_safe
23
- dry-container (0.2.7)
24
- dry-configurable (= 0.1.2)
35
+ dry-container (0.2.8)
36
+ dry-configurable (~> 0.1, >= 0.1.3)
25
37
  thread_safe
26
- dry-data (0.4.2)
38
+ dry-data (0.5.1)
27
39
  dry-configurable (~> 0.1)
28
40
  dry-container (~> 0.2)
29
41
  dry-equalizer (~> 0.2)
42
+ dry-logic (~> 0.1)
30
43
  inflecto (~> 0.0.0, >= 0.0.2)
31
44
  kleisli (~> 0.2)
32
45
  thread_safe (~> 0.3)
33
46
  dry-equalizer (0.2.0)
34
- dry-validation (0.4.1)
35
- dry-configurable (~> 0.1)
47
+ dry-logic (0.1.4)
36
48
  dry-container (~> 0.2, >= 0.2.6)
37
- dry-data (~> 0.4, >= 0.4.2)
38
49
  dry-equalizer (~> 0.2)
39
50
  inflecto (0.0.2)
40
51
  json (1.8.3)
@@ -84,6 +95,7 @@ PLATFORMS
84
95
  DEPENDENCIES
85
96
  bundler (~> 1.10)
86
97
  byebug
98
+ dry-validation!
87
99
  formalist!
88
100
  pry
89
101
  rake (~> 10.4.2)
data/README.md CHANGED
@@ -6,13 +6,16 @@
6
6
 
7
7
  ## Installation
8
8
 
9
- Add this line to your application’s `Gemfile`:
9
+ Add these lines to your application’s `Gemfile`:
10
10
 
11
11
  ```ruby
12
+ gem "dry-validation", git: "https://github.com/dryrb/dry-validation", ref: "6447302f3b53766b29f29230831890a5cc3822e0"
12
13
  gem "formalist"
13
14
  ```
14
15
 
15
- Run `bundle` to install the gem.
16
+ The dry-validation dependency is a temporary lock to a version that offers the AST/error message structures we expect. You should be able to remove this after future releases of formalist and dry-validation.
17
+
18
+ Run `bundle` to install the gems.
16
19
 
17
20
  ## Contributing
18
21
 
@@ -1,12 +1,16 @@
1
1
  require "dry-container"
2
2
  require "formalist/display_adapters/default"
3
+ require "formalist/display_adapters/radio"
3
4
  require "formalist/display_adapters/select"
5
+ require "formalist/display_adapters/textarea"
4
6
 
5
7
  module Formalist
6
8
  class DisplayAdapters
7
9
  extend Dry::Container::Mixin
8
10
 
9
11
  register DEFAULT_DISPLAY_ADAPTER, Default.new
12
+ register "radio", Radio.new
10
13
  register "select", Select.new
14
+ register "textarea", Textarea.new
11
15
  end
12
16
  end
@@ -0,0 +1,14 @@
1
+ module Formalist
2
+ class DisplayAdapters
3
+ class Textarea
4
+ PERMITTED_TYPES = %w[
5
+ string
6
+ ].freeze
7
+
8
+ def call(field)
9
+ raise ArgumentError, "field type must be one of #{PERMITTED_TYPES.join(', ')}" unless PERMITTED_TYPES.include?(field.type)
10
+ field.to_display_variant("textarea")
11
+ end
12
+ end
13
+ end
14
+ end
@@ -21,24 +21,25 @@ module Formalist
21
21
  end
22
22
 
23
23
  # @api private
24
- attr_reader :elements
24
+ attr_reader :schema
25
25
 
26
26
  # @api private
27
- attr_reader :schema
27
+ attr_reader :elements
28
28
 
29
- def initialize(schema: nil)
29
+ def initialize(schema)
30
30
  definition_compiler = DefinitionCompiler.new(self.class.display_adapters)
31
+
31
32
  @elements = definition_compiler.call(self.class.elements)
32
33
  @schema = schema
33
34
  end
34
35
 
35
- def call(input = {}, options = {})
36
- validate = options.fetch(:validate, true)
37
-
38
- rules = schema ? schema.rules.map(&:to_ary) : []
39
- errors = validate && schema ? schema.(input).messages : {}
36
+ def build(input)
37
+ Result.new(schema, elements, input)
38
+ end
40
39
 
41
- Result.new(elements.map { |el| el.(input, rules, errors) })
40
+ def receive(form_post)
41
+ input = schema.(form_post).output
42
+ build(input)
42
43
  end
43
44
  end
44
45
  end
@@ -1,14 +1,45 @@
1
+ require "formalist/form/validated_result"
2
+
1
3
  module Formalist
2
4
  class Form
3
5
  class Result
6
+ # @api private
7
+ attr_reader :input
8
+
9
+ # @api private
10
+ attr_reader :schema
11
+
12
+ # @api private
4
13
  attr_reader :elements
5
14
 
6
- def initialize(elements)
15
+ # @api public
16
+ attr_reader :validation
17
+
18
+ def initialize(schema, elements, input)
19
+ @input = input
20
+ @schema = schema
7
21
  @elements = elements
22
+ @validation = schema.(input)
23
+ end
24
+
25
+ def output
26
+ validation.output
27
+ end
28
+
29
+ def success?
30
+ true
31
+ end
32
+
33
+ def messages
34
+ {}
35
+ end
36
+
37
+ def to_ast
38
+ elements.map { |el| el.(output, schema.rules.map(&:to_ary), messages).to_ast }
8
39
  end
9
40
 
10
- def to_ary
11
- elements.map(&:to_ary)
41
+ def validate
42
+ ValidatedResult.new(self)
12
43
  end
13
44
  end
14
45
  end
@@ -40,7 +40,7 @@ module Formalist
40
40
  # 1. Child form elements
41
41
  #
42
42
  # @example "metadata" attr
43
- # attr.to_ary # =>
43
+ # attr.to_ast # =>
44
44
  # # [:attr, [
45
45
  # # :metadata,
46
46
  # # [
@@ -53,7 +53,7 @@ module Formalist
53
53
  # # ]]
54
54
  #
55
55
  # @return [Array] the attribute as an array.
56
- def to_ary
56
+ def to_ast
57
57
  # Errors, if the attr hash is present and its members have errors:
58
58
  # {:meta=>[[{:pages=>[["pages is missing"], nil]}], {}]}
59
59
 
@@ -66,7 +66,7 @@ module Formalist
66
66
  definition.name,
67
67
  value_predicates,
68
68
  local_errors,
69
- children.map(&:to_ary),
69
+ children.map(&:to_ast),
70
70
  ]]
71
71
  end
72
72
 
@@ -28,7 +28,7 @@ module Formalist
28
28
  # 1. Child form elements
29
29
  #
30
30
  # @example
31
- # component.to_ary # =>
31
+ # component.to_ast # =>
32
32
  # # [:component, [
33
33
  # # [
34
34
  # # [:some_config_name, :some_config_value]
@@ -39,10 +39,10 @@ module Formalist
39
39
  # # ]]
40
40
  #
41
41
  # @return [Array] the component as an array.
42
- def to_ary
42
+ def to_ast
43
43
  [:component, [
44
44
  definition.config.to_a,
45
- children.map(&:to_ary),
45
+ children.map(&:to_ast),
46
46
  ]]
47
47
  end
48
48
  end
@@ -38,7 +38,7 @@ module Formalist
38
38
  # 1. Field configuration
39
39
  #
40
40
  # @example "email" field
41
- # field.to_ary # =>
41
+ # field.to_ast # =>
42
42
  # # [:field, [
43
43
  # # :email,
44
44
  # # "string",
@@ -57,7 +57,7 @@ module Formalist
57
57
  # # ]]
58
58
  #
59
59
  # @return [Array] the field as an array.
60
- def to_ary
60
+ def to_ast
61
61
  # errors looks like this
62
62
  # {:field_name => [["pages is missing", "another error message"], nil]}
63
63
 
@@ -28,7 +28,7 @@ module Formalist
28
28
  # 1. Child form elements
29
29
  #
30
30
  # @example
31
- # group.to_ary # =>
31
+ # group.to_ast # =>
32
32
  # # [:group, [
33
33
  # # [
34
34
  # # [:some_config_name, :some_config_value]
@@ -39,10 +39,10 @@ module Formalist
39
39
  # # ]]
40
40
  #
41
41
  # @return [Array] the group as an array.
42
- def to_ary
42
+ def to_ast
43
43
  [:group, [
44
44
  definition.config.to_a,
45
- children.map(&:to_ary),
45
+ children.map(&:to_ast),
46
46
  ]]
47
47
  end
48
48
  end
@@ -46,7 +46,7 @@ module Formalist
46
46
  # none, if there is no or empty input data)
47
47
  #
48
48
  # @example "locations" collection
49
- # many.to_ary # =>
49
+ # many.to_ast # =>
50
50
  # # [:many, [
51
51
  # # :locations,
52
52
  # # [[:predicate, [:min_size?, [3]]]],
@@ -73,7 +73,7 @@ module Formalist
73
73
  # # ]]
74
74
  #
75
75
  # @return [Array] the collection as an array.
76
- def to_ary
76
+ def to_ast
77
77
  local_errors = errors.select { |e| e.is_a?(String) }
78
78
 
79
79
  [:many, [
@@ -81,8 +81,8 @@ module Formalist
81
81
  value_predicates,
82
82
  local_errors,
83
83
  definition.config.to_a,
84
- child_template.map(&:to_ary),
85
- children.map { |el_list| el_list.map(&:to_ary) },
84
+ child_template.map(&:to_ast),
85
+ children.map { |el_list| el_list.map(&:to_ast) },
86
86
  ]]
87
87
  end
88
88
 
@@ -97,24 +97,20 @@ module Formalist
97
97
 
98
98
  def build_children
99
99
  # child errors looks like this:
100
- # {:links=>
101
- # [[{:links=>
102
- # [[{:url=>[["url must be filled"], ""]}],
103
- # {:name=>"personal", :url=>""}]}],
104
- # [{:name=>"company", :url=>"http://icelab.com.au"},
105
- # {:name=>"personal", :url=>""}]]}
100
+ # [
101
+ # {:rating=>[["rating must be greater than or equal to 1"], 0]},
102
+ # {:summary=>"Great", :rating=>0},
103
+ # {:summary=>[["summary must be filled"], ""]},
104
+ # {:summary=>"", :rating=>1}
105
+ # ]
106
106
  #
107
107
  # or local errors:
108
108
  # {:links=>[["links is missing"], nil]}
109
109
 
110
- child_errors = errors[0].is_a?(Hash) ? errors : {}
110
+ child_errors = errors.each_slice(2).to_a
111
111
 
112
112
  input.map { |child_input|
113
113
  local_child_errors = child_errors.select { |e|
114
- e.is_a?(Hash)
115
- }.map { |e|
116
- e[definition.name]
117
- }.detect { |e|
118
114
  e[1] == child_input
119
115
  }.to_a.dig(0, 0) || {}
120
116
 
@@ -29,7 +29,7 @@ module Formalist
29
29
  # 1. Child form elements
30
30
  #
31
31
  # @example "content" section
32
- # section.to_ary # =>
32
+ # section.to_ast # =>
33
33
  # # [:section, [
34
34
  # # :content,
35
35
  # # [
@@ -41,11 +41,11 @@ module Formalist
41
41
  # # ]]
42
42
  #
43
43
  # @return [Array] the section as an array.
44
- def to_ary
44
+ def to_ast
45
45
  [:section, [
46
46
  definition.name,
47
47
  definition.config.to_a,
48
- children.map(&:to_ary),
48
+ children.map(&:to_ast),
49
49
  ]]
50
50
  end
51
51
  end
@@ -0,0 +1,35 @@
1
+ require "forwardable"
2
+
3
+ module Formalist
4
+ class Form
5
+ class ValidatedResult
6
+ extend Forwardable
7
+
8
+ def_delegators :@result,
9
+ :input,
10
+ :schema,
11
+ :elements,
12
+ :validation,
13
+ :output
14
+
15
+ # @api private
16
+ attr_reader :result
17
+
18
+ def initialize(result)
19
+ @result = result
20
+ end
21
+
22
+ def success?
23
+ validation.success?
24
+ end
25
+
26
+ def messages
27
+ validation.messages
28
+ end
29
+
30
+ def to_ast
31
+ elements.map { |el| el.(output, schema.rules.map(&:to_ary), messages).to_ast }
32
+ end
33
+ end
34
+ end
35
+ end
@@ -26,6 +26,10 @@ module Formalist
26
26
 
27
27
  def visit_val(node)
28
28
  name, predicate = node
29
+
30
+ # Support names that show as keypaths, e.g. [:reviews, :rating]
31
+ name = name.last if name.is_a?(Array)
32
+
29
33
  return [] unless name == target_name
30
34
 
31
35
  # Skip the "val" prefix
@@ -1,3 +1,3 @@
1
1
  module Formalist
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.2.0".freeze
3
3
  end
@@ -1,8 +1,7 @@
1
1
  example_id | status | run_time |
2
2
  ------------------------------------------------ | ------ | --------------- |
3
- ./spec/integration/display_adapters_spec.rb[1:1] | passed | 0.00016 seconds |
4
- ./spec/integration/display_adapters_spec.rb[1:2] | passed | 0.00024 seconds |
5
- ./spec/integration/form_spec.rb[1:1] | passed | 0.00021 seconds |
6
- ./spec/integration/new_spec.rb[1:1] | passed | 0.00063 seconds |
7
- ./spec/integration/validation_spec.rb[1:1] | passed | 0.00435 seconds |
8
- ./spec/unit/output_compiler_spec.rb[1:1] | passed | 0.00049 seconds |
3
+ ./spec/integration/display_adapters_spec.rb[1:1] | passed | 0.00184 seconds |
4
+ ./spec/integration/display_adapters_spec.rb[1:2] | passed | 0.00228 seconds |
5
+ ./spec/integration/form_spec.rb[1:1] | passed | 0.00232 seconds |
6
+ ./spec/integration/validation_spec.rb[1:1] | passed | 0.00607 seconds |
7
+ ./spec/unit/output_compiler_spec.rb[1:1] | passed | 0.00276 seconds |
@@ -1,12 +1,18 @@
1
1
  RSpec.describe "Display adapters" do
2
+ let(:schema) {
3
+ Class.new(Dry::Validation::Schema) do
4
+ key(:temperature_unit)
5
+ end.new
6
+ }
7
+
2
8
  subject(:form) {
3
9
  Class.new(Formalist::Form) do
4
10
  field :temperature_unit, type: "string", display: "select", option_values: [%w[c c], %w[f f]]
5
- end.new
11
+ end.new(schema)
6
12
  }
7
13
 
8
14
  it "outputs an AST" do
9
- expect(form.({}).to_ary).to eq [
15
+ expect(form.build({}).to_ast).to eq [
10
16
  [:field, [
11
17
  :temperature_unit,
12
18
  "string",
@@ -39,9 +45,9 @@ RSpec.describe "Display adapters" do
39
45
 
40
46
  field :name, type: "string", display: "custom"
41
47
  field :email, type: "string"
42
- end.new
48
+ end.new(schema)
43
49
 
44
- expect(form.({}).to_ary).to eq [
50
+ expect(form.build({}).to_ast).to eq [
45
51
  [:field, [:name, "string", "custom", nil, [], [], []]],
46
52
  [:field, [:email, "string", "default", nil, [], [], []]],
47
53
  ]
@@ -1,20 +1,29 @@
1
1
  RSpec.describe Formalist::Form do
2
+ let(:schema) {
3
+ Class.new(Dry::Validation::Schema) do
4
+ key(:title, &:str?)
5
+ key(:rating, &:int?)
6
+ end.new
7
+ }
8
+
2
9
  subject(:form) {
3
10
  Class.new(Formalist::Form) do
4
11
  component do |c|
5
12
  c.field :title, type: "string"
6
13
  c.field :rating, type: "int"
7
14
  end
8
- end.new
15
+ end.new(schema)
9
16
  }
10
17
 
11
18
  it "outputs an AST" do
12
- expect(form.(title: "Aurora", rating: 10).to_ary).to eq [
19
+ ast = form.build(title: "Aurora", rating: 10).to_ast
20
+
21
+ expect(form.build(title: "Aurora", rating: 10).to_ast).to eq [
13
22
  [:component, [
14
23
  [],
15
24
  [
16
- [:field, [:title, "string", "default", "Aurora", [], [], []]],
17
- [:field, [:rating, "int", "default", 10, [], [], []]]
25
+ [:field, [:title, "string", "default", "Aurora", [[:predicate, [:str?, []]]], [], []]],
26
+ [:field, [:rating, "int", "default", 10, [[:predicate, [:int?, []]]], [], []]]
18
27
  ],
19
28
  ]],
20
29
  ]
@@ -16,9 +16,12 @@ RSpec.describe "Form validation" do
16
16
 
17
17
  end
18
18
 
19
- key(:meta) do |meta|
20
- meta.key(:pages) { |pages| pages.filled? }
21
- end
19
+ # TODO: uncomment/fix the "meta" related sections (here and below) once
20
+ # we have a clarification on dryrb/dry-validation#58.
21
+ #
22
+ # key(:meta) do |meta|
23
+ # meta.key(:pages) { |pages| pages.filled? }
24
+ # end
22
25
  end.new
23
26
  }
24
27
 
@@ -32,10 +35,10 @@ RSpec.describe "Form validation" do
32
35
  review.field :rating, type: "int"
33
36
  end
34
37
 
35
- attr :meta do |meta|
36
- meta.field :pages, type: "int"
37
- end
38
- end.new(schema: schema)
38
+ # attr :meta do |meta|
39
+ # meta.field :pages, type: "int"
40
+ # end
41
+ end.new(schema)
39
42
  }
40
43
 
41
44
  it "includes validation rules and errors in the AST" do
@@ -44,7 +47,7 @@ RSpec.describe "Form validation" do
44
47
  meta: {pages: nil}
45
48
  }
46
49
 
47
- expect(form.call(input).to_ary).to eq [
50
+ expect(form.build(input).validate.to_ast).to eq [
48
51
  [:field, [:title, "string", "default", nil, [[:predicate, [:filled?, []]]], ["title is missing"], []]],
49
52
  [:field, [:rating, "int", "default", nil, [[:and, [[:predicate, [:gteq?, [1]]], [:predicate, [:lteq?, [10]]]]]], ["rating is missing", "rating must be greater than or equal to 1", "rating must be less than or equal to 10"], []]],
50
53
  [:many, [:reviews,
@@ -71,13 +74,13 @@ RSpec.describe "Form validation" do
71
74
  ]
72
75
  ],
73
76
  ]],
74
- [:attr, [:meta,
75
- [],
76
- [],
77
- [
78
- [:field, [:pages, "int", "default", nil, [[:predicate, [:filled?, []]]], ["pages must be filled"], []]]
79
- ],
80
- ]]
77
+ # [:attr, [:meta,
78
+ # [],
79
+ # [],
80
+ # [
81
+ # [:field, [:pages, "int", "default", nil, [[:predicate, [:filled?, []]]], ["pages must be filled"], []]]
82
+ # ],
83
+ # ]]
81
84
  ]
82
85
  end
83
86
  end
@@ -1,6 +1,25 @@
1
1
  RSpec.describe Formalist::OutputCompiler do
2
2
  subject(:compiler) { Formalist::OutputCompiler.new }
3
3
 
4
+ let(:schema) {
5
+ Class.new(Dry::Validation::Schema) do
6
+ key(:title, &:str?)
7
+ key(:rating, &:int?)
8
+
9
+ key(:reviews) do |reviews|
10
+ reviews.each do |review|
11
+ review.key(:description, &:str?)
12
+ review.key(:rating, &:int?)
13
+ end
14
+ end
15
+
16
+ key(:meta) do |meta|
17
+ meta.key(:pages, &:int?)
18
+ meta.key(:publisher, &:str?)
19
+ end
20
+ end.new
21
+ }
22
+
4
23
  let(:form) {
5
24
  Class.new(Formalist::Form) do
6
25
  field :title, type: "string"
@@ -19,7 +38,7 @@ RSpec.describe Formalist::OutputCompiler do
19
38
  end
20
39
  end
21
40
  end
22
- end.new
41
+ end.new(schema)
23
42
  }
24
43
 
25
44
  let(:input) {
@@ -43,7 +62,7 @@ RSpec.describe Formalist::OutputCompiler do
43
62
  }
44
63
  }
45
64
 
46
- let(:ast) { form.call(input).to_ary }
65
+ let(:ast) { form.build(input).to_ast }
47
66
 
48
67
  it "works" do
49
68
  expect(compiler.call(ast)).to eq input
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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Riley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-18 00:00:00.000000000 Z
11
+ date: 2016-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: dry-validation
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.6.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 0.6.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: inflecto
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -196,6 +196,7 @@ files:
196
196
  - lib/formalist/display_adapters/default.rb
197
197
  - lib/formalist/display_adapters/radio.rb
198
198
  - lib/formalist/display_adapters/select.rb
199
+ - lib/formalist/display_adapters/textarea.rb
199
200
  - lib/formalist/form.rb
200
201
  - lib/formalist/form/definition.rb
201
202
  - lib/formalist/form/definition/attr.rb
@@ -212,6 +213,7 @@ files:
212
213
  - lib/formalist/form/result/group.rb
213
214
  - lib/formalist/form/result/many.rb
214
215
  - lib/formalist/form/result/section.rb
216
+ - lib/formalist/form/validated_result.rb
215
217
  - lib/formalist/output_compiler.rb
216
218
  - lib/formalist/validation/collection_rules_compiler.rb
217
219
  - lib/formalist/validation/predicate_list_compiler.rb
@@ -220,7 +222,6 @@ files:
220
222
  - spec/examples.txt
221
223
  - spec/integration/display_adapters_spec.rb
222
224
  - spec/integration/form_spec.rb
223
- - spec/integration/new_spec.rb
224
225
  - spec/integration/validation_spec.rb
225
226
  - spec/spec_helper.rb
226
227
  - spec/unit/output_compiler_spec.rb
@@ -1,27 +0,0 @@
1
- # require "pp"
2
-
3
- # RSpec.describe Formalist::Form do
4
- # subject(:form) {
5
- # Class.new(Formalist::Form) do
6
- # field :title, type: "string"
7
- # field :rating, type: "int"
8
-
9
- # section :clever do |clever|
10
- # clever.field :more, type: "string"
11
- # end
12
- # end.new
13
- # }
14
-
15
- # it "works" do
16
- # # puts
17
- # # p form
18
- # # p form.class.elements
19
- # # p form.class.elements.first
20
-
21
- # # byebug
22
-
23
- # # puts
24
-
25
- # # pp form.elements
26
- # end
27
- # end