formalist 0.5.4 → 0.6.0

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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/formalist.gemspec +2 -3
  4. data/lib/formalist/element.rb +3 -10
  5. data/lib/formalist/element/class_interface.rb +2 -53
  6. data/lib/formalist/elements/attr.rb +1 -2
  7. data/lib/formalist/elements/compound_field.rb +0 -1
  8. data/lib/formalist/elements/field.rb +5 -6
  9. data/lib/formalist/elements/group.rb +1 -2
  10. data/lib/formalist/elements/many.rb +6 -7
  11. data/lib/formalist/elements/section.rb +1 -2
  12. data/lib/formalist/elements/standard/check_box.rb +1 -2
  13. data/lib/formalist/elements/standard/date_field.rb +0 -1
  14. data/lib/formalist/elements/standard/date_time_field.rb +2 -3
  15. data/lib/formalist/elements/standard/multi_selection_field.rb +6 -7
  16. data/lib/formalist/elements/standard/multi_upload_field.rb +12 -13
  17. data/lib/formalist/elements/standard/number_field.rb +3 -6
  18. data/lib/formalist/elements/standard/radio_buttons.rb +1 -2
  19. data/lib/formalist/elements/standard/rich_text_area.rb +4 -5
  20. data/lib/formalist/elements/standard/search_multi_selection_field.rb +12 -13
  21. data/lib/formalist/elements/standard/search_selection_field.rb +9 -10
  22. data/lib/formalist/elements/standard/select_box.rb +1 -2
  23. data/lib/formalist/elements/standard/selection_field.rb +4 -5
  24. data/lib/formalist/elements/standard/tags_field.rb +4 -5
  25. data/lib/formalist/elements/standard/text_area.rb +3 -4
  26. data/lib/formalist/elements/standard/text_field.rb +3 -4
  27. data/lib/formalist/elements/standard/upload_field.rb +10 -11
  28. data/lib/formalist/version.rb +1 -1
  29. metadata +9 -25
  30. data/lib/formalist/types.rb +0 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1323fdd5950cdc3185d1f5c97095c2b6b5a4c895122eb56e422a65a583b116cf
4
- data.tar.gz: bf631eb58ccd943f01099a551cb5dc390897e96e84bee193054adb07d0c35e11
3
+ metadata.gz: 812b680bec83258e220c4ad7e003db7aacc7f333cee556cd93079c22aeebbca6
4
+ data.tar.gz: fc45315295d88673cb31220b0e2dddd299f5ec2804f6230b9ee99135fcaba1f7
5
5
  SHA512:
6
- metadata.gz: d3846cadc6cafa398dbb644ed6963e793d644e28e0e4a428bf285a4d369c27285bbd77f99cf7a0f889dfd37665b0bdfaa70da4ebde74394400ff0d4954eacd53
7
- data.tar.gz: 41a5a177e35653ce0afc4ea48d5760dc80b9ff35728bdd558b2163d9530acf1a84741983bb571372f61116e1caa29879d56f23d2cb6dcf32b4d26bea32a63138
6
+ metadata.gz: dd154e92d8e422108e4c46005a68c3072b41dee80781499da1c3c521e82bc5aeda5471466c30ee1ed021bdab703215bd589c92b042b35936503e1dc740884575
7
+ data.tar.gz: b8d7a67e86633126f6d5a0620018ea4698742e52d511be24bd9eaaffa85c1bebcdf62d0d0b7cda4cb6b4fdf68d46052d9bd2d29dfd0bdda1531221126128d30e
@@ -1,3 +1,9 @@
1
+ # 0.6.0 / 2020-05-06
2
+
3
+ ### Changed
4
+
5
+ - Removed dry-types dependency from core gem
6
+
1
7
  # 0.5.4 / 2018-11-28
2
8
 
3
9
  ### Fixed
@@ -22,11 +22,10 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency "dry-configurable", "~> 0.7"
23
23
  spec.add_runtime_dependency "dry-core", "~> 0.4"
24
24
  spec.add_runtime_dependency "dry-container", "~> 0.6"
25
- spec.add_runtime_dependency "dry-types", "~> 0.13"
26
25
  spec.add_runtime_dependency "inflecto"
27
26
 
28
- spec.add_development_dependency "bundler", "~> 1.10"
29
- spec.add_development_dependency "rake", "~> 10.4.2"
27
+ spec.add_development_dependency "bundler"
28
+ spec.add_development_dependency "rake", "~> 10.4"
30
29
  spec.add_development_dependency "rspec", "~> 3.3.0"
31
30
  spec.add_development_dependency "simplecov", "~> 0.13.0"
32
31
  spec.add_development_dependency "yard"
@@ -1,6 +1,5 @@
1
1
  require "formalist/element/attributes"
2
2
  require "formalist/element/class_interface"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Element
@@ -21,19 +20,13 @@ module Formalist
21
20
 
22
21
  # @api private
23
22
  def initialize(name: nil, attributes: {}, children: [], input: nil, errors: [])
24
- @name = Types::ElementName[name]
23
+ @name = name&.to_sym
25
24
 
26
- # Set supplied attributes or their defaults
27
- all_attributes = self.class.attributes_schema.each_with_object({}) { |(name, defn), memo|
25
+ @attributes = self.class.attributes_schema.each_with_object({}) { |(name, defn), hsh|
28
26
  value = attributes.fetch(name) { defn[:default] }
29
- memo[name] = value unless value.nil?
27
+ hsh[name] = value unless value.nil?
30
28
  }
31
29
 
32
- # Then run them through the schema
33
- @attributes = Types::Hash.weak(
34
- self.class.attributes_schema.map { |name, defn| [name, defn[:type]] }.to_h
35
- )[all_attributes]
36
-
37
30
  @children = children
38
31
  @input = input
39
32
  @errors = errors
@@ -4,63 +4,14 @@ module Formalist
4
4
  class Element
5
5
  # Class-level API for form elements.
6
6
  module ClassInterface
7
- # Returns the element's type, which is a symbolized, underscored
8
- # representation of the element's class name.
9
- #
10
- # This is important for form rendering when using custom form elements,
11
- # since the type in this case will be based on the name of form element's
12
- # sublass.
13
- #
14
- # @example Basic element Formalist::Elements::Field.type # => :field
15
- #
16
- # @example Custom element class MyField < Formalist::Elements::Field end
17
- #
18
- # MyField.type # => :my_field
19
- #
20
- # @!scope class @return [Symbol] the element type.
21
7
  def type
22
8
  Inflecto.underscore(Inflecto.demodulize(name)).to_sym
23
9
  end
24
10
 
25
- # Define a form element attribute.
26
- #
27
- # Form element attributes can be set when the element is defined, and
28
- # can be further populated by the form element object itself, when the
29
- # form is being built, using both the user input and any dependencies
30
- # passed to the element via the form.
31
- #
32
- # Attributes are the way to ensure the form renderer has all the
33
- # information it needs to render the element appropriately. Attributes
34
- # are type-checked in order to ensure they're being passed appropriate
35
- # values. Attributes can hold any type of value as long as it can be
36
- # reduced to an abstract syntax tree representation by
37
- # `Form::Element::Attributes#to_ast`.
38
- #
39
- # @see Formalist::Element::Attributes#to_ast
40
- #
41
- # @!scope class
42
- # @param name [Symbol] attribute name
43
- # @param type [Dry::Data::Type, #call] value type coercer/checker
44
- # @param default default value (applied when the attribute is not explicitly populated)
45
- # @return void
46
- def attribute(name, type, default: nil)
47
- attributes(name => {type: type, default: default})
11
+ def attribute(name, default: nil)
12
+ attributes(name => {default: default})
48
13
  end
49
14
 
50
- # Returns the attributes schema for the form element.
51
- #
52
- # Each item in the schema includes a type definition and a default value
53
- # (`nil` if none specified).
54
- #
55
- # @example
56
- # Formalist::Elements::Field.attributes_schema
57
- # # => {
58
- # :name => {:type => #<Dry::Data::Type>, :default => "Default name"},
59
- # :email => {:type => #<Dry::Data::Type>, :default => "default email"}
60
- # }
61
- #
62
- # @!scope class
63
- # @return [Hash<Symbol, Hash>] the attributes schema
64
15
  def attributes_schema
65
16
  super_schema = superclass.respond_to?(:attributes_schema) ? superclass.attributes_schema : {}
66
17
  super_schema.merge(@attributes_schema || {})
@@ -68,8 +19,6 @@ module Formalist
68
19
 
69
20
  private
70
21
 
71
- # @!scope class
72
- # @api private
73
22
  def attributes(new_schema)
74
23
  prev_schema = @attributes_schema || {}
75
24
  @attributes_schema = prev_schema.merge(new_schema)
@@ -1,10 +1,9 @@
1
1
  require "formalist/element"
2
- require "formalist/types"
3
2
 
4
3
  module Formalist
5
4
  class Elements
6
5
  class Attr < Element
7
- attribute :label, Types::String
6
+ attribute :label
8
7
 
9
8
  def fill(input:, errors:)
10
9
  input = input[name] || {}
@@ -1,5 +1,4 @@
1
1
  require "formalist/element"
2
- require "formalist/types"
3
2
 
4
3
  module Formalist
5
4
  class Elements
@@ -1,14 +1,13 @@
1
1
  require "formalist/element"
2
- require "formalist/types"
3
2
 
4
3
  module Formalist
5
4
  class Elements
6
5
  class Field < Element
7
- attribute :label, Types::String
8
- attribute :hint, Types::String
9
- attribute :placeholder, Types::String
10
- attribute :inline, Types::Bool
11
- attribute :validation, Types::Validation
6
+ attribute :label
7
+ attribute :hint
8
+ attribute :placeholder
9
+ attribute :inline
10
+ attribute :validation
12
11
 
13
12
  def fill(input: {}, errors: {})
14
13
  super(
@@ -1,10 +1,9 @@
1
1
  require "formalist/element"
2
- require "formalist/types"
3
2
 
4
3
  module Formalist
5
4
  class Elements
6
5
  class Group < Element
7
- attribute :label, Types::String
6
+ attribute :label
8
7
 
9
8
  def fill(input: {}, errors: {})
10
9
  children = self.children.map { |child|
@@ -1,15 +1,14 @@
1
1
  require "formalist/element"
2
- require "formalist/types"
3
2
 
4
3
  module Formalist
5
4
  class Elements
6
5
  class Many < Element
7
- attribute :action_label, Types::String
8
- attribute :sortable, Types::Bool
9
- attribute :label, Types::String
10
- attribute :max_height, Types::String
11
- attribute :placeholder, Types::String
12
- attribute :validation, Types::Validation
6
+ attribute :action_label
7
+ attribute :sortable
8
+ attribute :label
9
+ attribute :max_height
10
+ attribute :placeholder
11
+ attribute :validation
13
12
 
14
13
  # @api private
15
14
  attr_reader :child_template
@@ -1,10 +1,9 @@
1
1
  require "formalist/element"
2
- require "formalist/types"
3
2
 
4
3
  module Formalist
5
4
  class Elements
6
5
  class Section < Element
7
- attribute :label, Types::String
6
+ attribute :label
8
7
 
9
8
  def fill(input: {}, errors: {})
10
9
  super(
@@ -1,11 +1,10 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class CheckBox < Field
8
- attribute :question_text, Types::String
7
+ attribute :question_text
9
8
 
10
9
  def initialize(*)
11
10
  super
@@ -1,6 +1,5 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
@@ -1,12 +1,11 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class DateTimeField < Field
8
- attribute :time_format, Types::String
9
- attribute :human_time_format, Types::String
7
+ attribute :time_format
8
+ attribute :human_time_format
10
9
  end
11
10
 
12
11
  register :date_time_field, DateTimeField
@@ -1,16 +1,15 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class MultiSelectionField < Field
8
- attribute :sortable, Types::Bool
9
- attribute :max_height, Types::String
10
- attribute :options, Types::SelectionsList
11
- attribute :render_option_as, Types::String
12
- attribute :render_selection_as, Types::String
13
- attribute :selector_label, Types::String
7
+ attribute :sortable
8
+ attribute :max_height
9
+ attribute :options
10
+ attribute :render_option_as
11
+ attribute :render_selection_as
12
+ attribute :selector_label
14
13
  end
15
14
 
16
15
  register :multi_selection_field, MultiSelectionField
@@ -1,22 +1,21 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class MultiUploadField < Field
8
- attribute :initial_attributes_url, Types::String
9
- attribute :sortable, Types::Bool
10
- attribute :max_file_size_message, Types::String
11
- attribute :max_file_size, Types::String
12
- attribute :max_height, Types::String
13
- attribute :permitted_file_type_message, Types::String
14
- attribute :permitted_file_type_regex, Types::String
15
- attribute :presign_options, Types::Hash
16
- attribute :presign_url, Types::String
17
- attribute :render_uploaded_as, Types::String
18
- attribute :upload_action_label, Types::String
19
- attribute :upload_prompt, Types::String
7
+ attribute :initial_attributes_url
8
+ attribute :sortable
9
+ attribute :max_file_size_message
10
+ attribute :max_file_size
11
+ attribute :max_height
12
+ attribute :permitted_file_type_message
13
+ attribute :permitted_file_type_regex
14
+ attribute :presign_options
15
+ attribute :presign_url
16
+ attribute :render_uploaded_as
17
+ attribute :upload_action_label
18
+ attribute :upload_prompt
20
19
  end
21
20
 
22
21
  register :multi_upload_field, MultiUploadField
@@ -1,15 +1,12 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class NumberField < Field
8
- Number = Types::Integer | Types::Float
9
-
10
- attribute :step, Number
11
- attribute :min, Number
12
- attribute :max, Number
7
+ attribute :step
8
+ attribute :min
9
+ attribute :max
13
10
  end
14
11
 
15
12
  register :number_field, NumberField
@@ -1,11 +1,10 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class RadioButtons < Field
8
- attribute :options, Types::OptionsList
7
+ attribute :options
9
8
  end
10
9
 
11
10
  register :radio_buttons, RadioButtons
@@ -1,15 +1,14 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
  require "formalist/rich_text/embedded_form_compiler"
5
4
 
6
5
  module Formalist
7
6
  class Elements
8
7
  class RichTextArea < Field
9
- attribute :box_size, Types::String.enum("single", "small", "normal", "large", "xlarge"), default: "normal"
10
- attribute :inline_formatters, Types::Array
11
- attribute :block_formatters, Types::Array
12
- attribute :embeddable_forms, Types::Dependency.constrained(respond_to: :to_h)
8
+ attribute :box_size, default: "normal"
9
+ attribute :inline_formatters
10
+ attribute :block_formatters
11
+ attribute :embeddable_forms
13
12
 
14
13
  # FIXME: it would be tidier to have a reader method for each attribute
15
14
  def attributes
@@ -1,22 +1,21 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class SearchMultiSelectionField < Field
8
- attribute :clear_query_on_selection, Types::Bool
9
- attribute :sortable, Types::Bool
10
- attribute :max_height, Types::String
11
- attribute :render_option_as, Types::String
12
- attribute :render_option_control_as, Types::String
13
- attribute :render_selection_as, Types::String
14
- attribute :search_params, Types::Hash
15
- attribute :search_per_page, Types::Integer
16
- attribute :search_threshold, Types::Integer
17
- attribute :search_url, Types::String
18
- attribute :selections, Types::Array
19
- attribute :selector_label, Types::String
7
+ attribute :clear_query_on_selection
8
+ attribute :sortable
9
+ attribute :max_height
10
+ attribute :render_option_as
11
+ attribute :render_option_control_as
12
+ attribute :render_selection_as
13
+ attribute :search_params
14
+ attribute :search_per_page
15
+ attribute :search_threshold
16
+ attribute :search_url
17
+ attribute :selections
18
+ attribute :selector_label
20
19
  end
21
20
 
22
21
  register :search_multi_selection_field, SearchMultiSelectionField
@@ -1,19 +1,18 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class SearchSelectionField < Field
8
- attribute :selector_label, Types::String
9
- attribute :render_option_as, Types::String
10
- attribute :render_option_control_as, Types::String
11
- attribute :render_selection_as, Types::String
12
- attribute :search_url, Types::String
13
- attribute :search_per_page, Types::Integer
14
- attribute :search_params, Types::Hash
15
- attribute :search_threshold, Types::Integer
16
- attribute :selection, Types::Hash
7
+ attribute :selector_label
8
+ attribute :render_option_as
9
+ attribute :render_option_control_as
10
+ attribute :render_selection_as
11
+ attribute :search_url
12
+ attribute :search_per_page
13
+ attribute :search_params
14
+ attribute :search_threshold
15
+ attribute :selection
17
16
  end
18
17
 
19
18
  register :search_selection_field, SearchSelectionField
@@ -1,11 +1,10 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class SelectBox < Field
8
- attribute :options, Types::OptionsList
7
+ attribute :options
9
8
  end
10
9
 
11
10
  register :select_box, SelectBox
@@ -1,14 +1,13 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class SelectionField < Field
8
- attribute :options, Types::SelectionsList
9
- attribute :selector_label, Types::String
10
- attribute :render_option_as, Types::String
11
- attribute :render_selection_as, Types::String
7
+ attribute :options
8
+ attribute :selector_label
9
+ attribute :render_option_as
10
+ attribute :render_selection_as
12
11
  end
13
12
 
14
13
  register :selection_field, SelectionField
@@ -1,14 +1,13 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class TagsField < Field
8
- attribute :search_url, Types::String
9
- attribute :search_per_page, Types::Integer
10
- attribute :search_params, Types::Hash
11
- attribute :search_threshold, Types::Integer
7
+ attribute :search_url
8
+ attribute :search_per_page
9
+ attribute :search_params
10
+ attribute :search_threshold
12
11
  end
13
12
 
14
13
  register :tags_field, TagsField
@@ -1,13 +1,12 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class TextArea < Field
8
- attribute :text_size, Types::String.enum("xsmall", "small", "normal", "large", "xlarge"), default: "normal"
9
- attribute :box_size, Types::String.enum("single", "small", "normal", "large", "xlarge"), default: "normal"
10
- attribute :code, Types::Bool
7
+ attribute :text_size, default: "normal"
8
+ attribute :box_size, default: "normal"
9
+ attribute :code
11
10
  end
12
11
 
13
12
  register :text_area, TextArea
@@ -1,13 +1,12 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class TextField < Field
8
- attribute :password, Types::Bool
9
- attribute :code, Types::Bool
10
- attribute :disabled, Types::Bool
7
+ attribute :password
8
+ attribute :code
9
+ attribute :disabled
11
10
  end
12
11
 
13
12
  register :text_field, TextField
@@ -1,20 +1,19 @@
1
1
  require "formalist/element"
2
2
  require "formalist/elements"
3
- require "formalist/types"
4
3
 
5
4
  module Formalist
6
5
  class Elements
7
6
  class UploadField < Field
8
- attribute :initial_attributes_url, Types::String
9
- attribute :presign_url, Types::String
10
- attribute :presign_options, Types::Hash
11
- attribute :render_uploaded_as, Types::String
12
- attribute :upload_prompt, Types::String
13
- attribute :upload_action_label, Types::String
14
- attribute :max_file_size, Types::String
15
- attribute :max_file_size_message, Types::String
16
- attribute :permitted_file_type_message, Types::String
17
- attribute :permitted_file_type_regex, Types::String
7
+ attribute :initial_attributes_url
8
+ attribute :presign_url
9
+ attribute :presign_options
10
+ attribute :render_uploaded_as
11
+ attribute :upload_prompt
12
+ attribute :upload_action_label
13
+ attribute :max_file_size
14
+ attribute :max_file_size_message
15
+ attribute :permitted_file_type_message
16
+ attribute :permitted_file_type_regex
18
17
  end
19
18
 
20
19
  register :upload_field, UploadField
@@ -1,3 +1,3 @@
1
1
  module Formalist
2
- VERSION = "0.5.4".freeze
2
+ VERSION = "0.6.0".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.5.4
4
+ version: 0.6.0
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-11-28 00:00:00.000000000 Z
11
+ date: 2020-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.6'
55
- - !ruby/object:Gem::Dependency
56
- name: dry-types
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.13'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.13'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: inflecto
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -84,30 +70,30 @@ dependencies:
84
70
  name: bundler
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - "~>"
73
+ - - ">="
88
74
  - !ruby/object:Gem::Version
89
- version: '1.10'
75
+ version: '0'
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - "~>"
80
+ - - ">="
95
81
  - !ruby/object:Gem::Version
96
- version: '1.10'
82
+ version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: rake
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: 10.4.2
89
+ version: '10.4'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: 10.4.2
96
+ version: '10.4'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: rspec
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -208,7 +194,6 @@ files:
208
194
  - lib/formalist/rich_text/rendering/html_compiler.rb
209
195
  - lib/formalist/rich_text/rendering/html_renderer.rb
210
196
  - lib/formalist/rich_text/validity_check.rb
211
- - lib/formalist/types.rb
212
197
  - lib/formalist/version.rb
213
198
  homepage: https://github.com/icelab/formalist
214
199
  licenses:
@@ -229,8 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
214
  - !ruby/object:Gem::Version
230
215
  version: '0'
231
216
  requirements: []
232
- rubyforge_project:
233
- rubygems_version: 2.7.6
217
+ rubygems_version: 3.0.3
234
218
  signing_key:
235
219
  specification_version: 4
236
220
  summary: Flexible form builder
@@ -1,31 +0,0 @@
1
- # coding: utf-8
2
- require "dry/types"
3
-
4
- # TODO: Find a way to avoid registering this globally
5
- Dry::Logic::Predicates.predicate :respond_to? do |method_name, value|
6
- value.respond_to?(method_name)
7
- end
8
-
9
- module Formalist
10
- module Types
11
- include Dry::Types.module
12
-
13
- ElementName = Types::Strict::Symbol.constrained(min_size: 1).optional
14
- OptionsList = Types::Array.of(Formalist::Types::Array.of(Formalist::Types::Strict::String).constrained(size: 2))
15
-
16
- # The SelectionField and MultiSelectionField require a _somewhat_ specific
17
- # data structure:
18
- #
19
- # {id: 123, label: 'foo'}
20
- #
21
- # It’s expected that `id` is the relational representation of the object.
22
- # And label could/should be optional if the form defines a custom
23
- # `render_as` attribute
24
- SelectionsList = Formalist::Types::Strict::Array.of(Formalist::Types::Strict::Hash)
25
-
26
- Validation = Types::Strict::Hash
27
-
28
- Dependency = Types::Object
29
- Function = Dependency.constrained(respond_to: :call)
30
- end
31
- end