ciesta 0.3.1 → 0.3.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: 5eaf463aca332576deca118786495fe23b4c13c231e4b987061dd7b150ea4364
4
- data.tar.gz: ff94edfb892a18df09df01b0bce6706557475d69b0ad07f2d11b618bbda03fc2
3
+ metadata.gz: 2c546a423a524c000586945f454df552aad095cc9cf83c9f5a5a1f632c270a44
4
+ data.tar.gz: 2a8699af62652d17dc4f0705136855e827a1273488c873022c3057621058abfe
5
5
  SHA512:
6
- metadata.gz: dec6837b70b3d3169620e121290e5bcbe61f65ed94dbd461233daa98f66bd48b53e42143481fb9cebece32b21483a87391553b52b676e0b8cc0fbd1d8b8419f2
7
- data.tar.gz: 6d74105fe737dd8b202c3d995c5dbd0f43d5bca054dd2778baab3bcfc2c16844b4d26f7653719047a42493213b64a2cde9cbc6312464d798da3728ce993107ff
6
+ metadata.gz: 45f65ccdfbc46528f966fe48ccb799c1232bf67e00db3572569788b3560cd8b59c7d0154578c76bd71d234e38498025e13187af6d0a89ba8a7a236e794f72ef7
7
+ data.tar.gz: f8274e3f6e55fb7774634ea3ac47ed84514f3bcc50093220559192e4e52458bf7398e245824d0519577010ad393f2f10fa23eb4e40d18e770eb08003eae8141b
@@ -1,28 +1,15 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.1
3
- Exclude:
4
- - db/schema.rb
5
- - config/**/*.rb
6
-
7
- # Metrics
8
- Metrics/CyclomaticComplexity:
9
- Enabled: true
10
- Max: 6
2
+ TargetRubyVersion: 2.2
11
3
 
12
4
  Metrics/LineLength:
13
- Enabled: true
14
5
  Max: 100
15
- AllowHeredoc: true
16
- IgnoredPatterns: ['#.*']
6
+ Exclude:
7
+ - ciesta.gemspec
17
8
 
18
9
  Metrics/BlockLength:
19
- Enabled: false
20
-
21
- Metrics/MethodLength:
22
- Enabled: false
23
-
24
- Metrics/AbcSize:
25
- Enabled: false
10
+ Exclude:
11
+ - spec/**/*.rb
12
+ - ciesta.gemspec
26
13
 
27
14
  # Style
28
15
  Style/StringLiterals:
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ciesta (0.3.1)
5
- dry-types (~> 0.12.1)
6
- dry-validation (~> 0.11.1)
4
+ ciesta (0.3.2)
5
+ dry-types (~> 0.13)
6
+ dry-validation (~> 0.12)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -11,76 +11,77 @@ GEM
11
11
  ast (2.4.0)
12
12
  coderay (1.1.2)
13
13
  concurrent-ruby (1.0.5)
14
- coveralls (0.8.21)
14
+ coveralls (0.8.22)
15
15
  json (>= 1.8, < 3)
16
- simplecov (~> 0.14.1)
16
+ simplecov (~> 0.16.1)
17
17
  term-ansicolor (~> 1.3)
18
18
  thor (~> 0.19.4)
19
19
  tins (~> 1.6)
20
20
  diff-lcs (1.3)
21
- docile (1.1.5)
21
+ docile (1.3.1)
22
22
  dry-configurable (0.7.0)
23
23
  concurrent-ruby (~> 1.0)
24
24
  dry-container (0.6.0)
25
25
  concurrent-ruby (~> 1.0)
26
26
  dry-configurable (~> 0.1, >= 0.1.3)
27
- dry-core (0.4.6)
27
+ dry-core (0.4.7)
28
28
  concurrent-ruby (~> 1.0)
29
29
  dry-equalizer (0.2.1)
30
+ dry-inflector (0.1.2)
30
31
  dry-logic (0.4.2)
31
32
  dry-container (~> 0.2, >= 0.2.6)
32
33
  dry-core (~> 0.2)
33
34
  dry-equalizer (~> 0.2)
34
- dry-types (0.12.2)
35
+ dry-types (0.13.2)
35
36
  concurrent-ruby (~> 1.0)
36
- dry-configurable (~> 0.1)
37
37
  dry-container (~> 0.3)
38
- dry-core (~> 0.2, >= 0.2.1)
38
+ dry-core (~> 0.4, >= 0.4.4)
39
39
  dry-equalizer (~> 0.2)
40
+ dry-inflector (~> 0.1, >= 0.1.2)
40
41
  dry-logic (~> 0.4, >= 0.4.2)
41
- inflecto (~> 0.0.0, >= 0.0.2)
42
- dry-validation (0.11.1)
42
+ dry-validation (0.12.2)
43
43
  concurrent-ruby (~> 1.0)
44
44
  dry-configurable (~> 0.1, >= 0.1.3)
45
45
  dry-core (~> 0.2, >= 0.2.1)
46
46
  dry-equalizer (~> 0.2)
47
47
  dry-logic (~> 0.4, >= 0.4.0)
48
- dry-types (~> 0.12.0)
49
- inflecto (0.0.2)
48
+ dry-types (~> 0.13.1)
49
+ jaro_winkler (1.5.1)
50
50
  json (2.1.0)
51
51
  method_source (0.9.0)
52
52
  parallel (1.12.1)
53
- parser (2.5.1.0)
53
+ parser (2.5.1.2)
54
54
  ast (~> 2.4.0)
55
- powerpack (0.1.1)
55
+ powerpack (0.1.2)
56
56
  pry (0.11.3)
57
57
  coderay (~> 1.1.0)
58
58
  method_source (~> 0.9.0)
59
59
  rainbow (3.0.0)
60
60
  rake (10.5.0)
61
- rspec (3.7.0)
62
- rspec-core (~> 3.7.0)
63
- rspec-expectations (~> 3.7.0)
64
- rspec-mocks (~> 3.7.0)
65
- rspec-core (3.7.1)
66
- rspec-support (~> 3.7.0)
67
- rspec-expectations (3.7.0)
61
+ rspec (3.8.0)
62
+ rspec-core (~> 3.8.0)
63
+ rspec-expectations (~> 3.8.0)
64
+ rspec-mocks (~> 3.8.0)
65
+ rspec-core (3.8.0)
66
+ rspec-support (~> 3.8.0)
67
+ rspec-expectations (3.8.2)
68
68
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.7.0)
70
- rspec-mocks (3.7.0)
69
+ rspec-support (~> 3.8.0)
70
+ rspec-mocks (3.8.0)
71
71
  diff-lcs (>= 1.2.0, < 2.0)
72
- rspec-support (~> 3.7.0)
73
- rspec-support (3.7.1)
74
- rubocop (0.55.0)
72
+ rspec-support (~> 3.8.0)
73
+ rspec-support (3.8.0)
74
+ rubocop (0.59.2)
75
+ jaro_winkler (~> 1.5.1)
75
76
  parallel (~> 1.10)
76
- parser (>= 2.5)
77
+ parser (>= 2.5, != 2.5.1.1)
77
78
  powerpack (~> 0.1)
78
79
  rainbow (>= 2.2.2, < 4.0)
79
80
  ruby-progressbar (~> 1.7)
80
81
  unicode-display_width (~> 1.0, >= 1.0.1)
81
- ruby-progressbar (1.9.0)
82
- simplecov (0.14.1)
83
- docile (~> 1.1.0)
82
+ ruby-progressbar (1.10.0)
83
+ simplecov (0.16.1)
84
+ docile (~> 1.1)
84
85
  json (>= 1.8, < 3)
85
86
  simplecov-html (~> 0.10.0)
86
87
  simplecov-html (0.10.2)
@@ -88,7 +89,7 @@ GEM
88
89
  tins (~> 1.0)
89
90
  thor (0.19.4)
90
91
  tins (1.16.3)
91
- unicode-display_width (1.3.2)
92
+ unicode-display_width (1.4.0)
92
93
 
93
94
  PLATFORMS
94
95
  ruby
@@ -98,9 +99,9 @@ DEPENDENCIES
98
99
  ciesta!
99
100
  coveralls (~> 0.8)
100
101
  pry (~> 0.11)
101
- rake (~> 10.0)
102
- rspec (~> 3.0)
103
- rubocop (~> 0.52)
102
+ rake (~> 10.5)
103
+ rspec (~> 3.8)
104
+ rubocop (~> 0.59)
104
105
 
105
106
  BUNDLED WITH
106
- 1.16.1
107
+ 1.16.3
@@ -1,4 +1,3 @@
1
-
2
1
  # frozen_string_literal: true
3
2
 
4
3
  lib = File.expand_path('lib', __dir__)
@@ -9,7 +8,7 @@ Gem::Specification.new do |spec|
9
8
  spec.name = "ciesta"
10
9
  spec.version = Ciesta::VERSION
11
10
  spec.authors = ["Alexey"]
12
- spec.email = ["alex.coder1@gmail.com"]
11
+ spec.email = ["nulldefiner@gmail.com"]
13
12
 
14
13
  spec.summary = "Create form objects easy"
15
14
  spec.description = "Gem for creating and using form object"
@@ -25,18 +24,18 @@ Gem::Specification.new do |spec|
25
24
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
25
  f.match(%r{^(test|spec|features)/})
27
26
  end
28
- spec.bindir = "exe"
29
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.bindir = "bin"
28
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
30
29
  spec.require_paths = ["lib"]
31
- spec.required_ruby_version = ">= 2.1"
30
+ spec.required_ruby_version = ">= 2.2"
32
31
 
33
- spec.add_dependency "dry-types", "~> 0.12.1"
34
- spec.add_dependency "dry-validation", "~> 0.11.1"
32
+ spec.add_dependency "dry-types", "~> 0.13"
33
+ spec.add_dependency "dry-validation", "~> 0.12"
35
34
 
36
35
  spec.add_development_dependency "bundler", "~> 1.16"
37
36
  spec.add_development_dependency "coveralls", "~> 0.8"
38
37
  spec.add_development_dependency "pry", "~> 0.11"
39
- spec.add_development_dependency "rake", "~> 10.0"
40
- spec.add_development_dependency "rspec", "~> 3.0"
41
- spec.add_development_dependency "rubocop", "~> 0.52"
38
+ spec.add_development_dependency "rake", "~> 10.5"
39
+ spec.add_development_dependency "rspec", "~> 3.8"
40
+ spec.add_development_dependency "rubocop", "~> 0.59"
42
41
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "forwardable"
3
4
  require "dry-types"
4
5
  require "dry-validation"
5
- require "ciesta/delegator"
6
6
  require "ciesta/version"
7
7
  require "ciesta/field_list"
8
8
  require "ciesta/syncer"
@@ -18,7 +18,7 @@ module Ciesta
18
18
  def field(name, **options)
19
19
  name = name.to_sym
20
20
  fields << Ciesta::Field.new(name, options)
21
- proxy.instance_eval do
21
+ proxy.instance_eval do
22
22
  define_method(name) { self.class.fields[name] }
23
23
  define_method("#{name}=") { |value| self.class.fields[name] = value }
24
24
  end
@@ -76,7 +76,7 @@ class Ciesta::Field
76
76
  def default
77
77
  type[raw_default]
78
78
  rescue Dry::Types::ConstraintError
79
- raise Ciesta::ViolatesConstraints, "#{def_value} is not a #{type.name}"
79
+ raise Ciesta::ViolatesConstraints, "#{raw_default} is not a #{type.name}"
80
80
  end
81
81
 
82
82
  # Returns raw default value
@@ -1,21 +1,21 @@
1
1
  module Ciesta
2
2
  module InstanceMethods
3
- extend Ciesta::Delegator
3
+ extend Forwardable
4
4
 
5
5
  # @!method assign
6
6
  # @!method assign!
7
7
  # @!method attributes
8
8
  # @see Ciesta::FieldList
9
- delegate :assign, :assign!, :attributes, :clear!, to: :fields
9
+ def_delegators :fields, :assign, :assign!, :attributes, :clear!
10
10
 
11
11
  # @!method errors
12
12
  # @see Ciesta::Validator
13
- delegate :errors, to: :validator
13
+ def_delegators :validator, :errors
14
14
 
15
15
  # @!method sync
16
16
  # @!method sync!
17
17
  # @see Ciesta::Syncer
18
- delegate :sync, to: :syncer
18
+ def_delegators :syncer, :sync
19
19
 
20
20
  attr_accessor :object
21
21
 
@@ -56,6 +56,7 @@ module Ciesta
56
56
  # @return [Boolean]
57
57
  def sync!(&block)
58
58
  raise Ciesta::FormNotValid, "Form is not valid" unless valid?
59
+
59
60
  syncer.sync!(&block)
60
61
  end
61
62
 
@@ -17,7 +17,7 @@ class Ciesta::Validator
17
17
  # @api private
18
18
  # @param [Block] block Block wich returns the schema
19
19
  def use(&block)
20
- @schema = Dry::Validation.Form(&block)
20
+ @schema = Dry::Validation.Params(&block)
21
21
  end
22
22
 
23
23
  # Checks if schema is valid
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ciesta
4
- VERSION = "0.3.1".freeze
4
+ VERSION = "0.3.2".freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ciesta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-12 00:00:00.000000000 Z
11
+ date: 2018-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-types
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.12.1
19
+ version: '0.13'
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.12.1
26
+ version: '0.13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: dry-validation
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.11.1
33
+ version: '0.12'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.11.1
40
+ version: '0.12'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -86,46 +86,48 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '10.0'
89
+ version: '10.5'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '10.0'
96
+ version: '10.5'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '3.0'
103
+ version: '3.8'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '3.0'
110
+ version: '3.8'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0.52'
117
+ version: '0.59'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0.52'
124
+ version: '0.59'
125
125
  description: Gem for creating and using form object
126
126
  email:
127
- - alex.coder1@gmail.com
128
- executables: []
127
+ - nulldefiner@gmail.com
128
+ executables:
129
+ - console
130
+ - setup
129
131
  extensions: []
130
132
  extra_rdoc_files: []
131
133
  files:
@@ -145,7 +147,6 @@ files:
145
147
  - ciesta.gemspec
146
148
  - lib/ciesta.rb
147
149
  - lib/ciesta/class_methods.rb
148
- - lib/ciesta/delegator.rb
149
150
  - lib/ciesta/errors.rb
150
151
  - lib/ciesta/field.rb
151
152
  - lib/ciesta/field_list.rb
@@ -166,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
166
167
  requirements:
167
168
  - - ">="
168
169
  - !ruby/object:Gem::Version
169
- version: '2.1'
170
+ version: '2.2'
170
171
  required_rubygems_version: !ruby/object:Gem::Requirement
171
172
  requirements:
172
173
  - - ">="
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Simple module for delegate methods
4
- module Ciesta::Delegator
5
- # Delegates methods to object
6
- #
7
- # @param [Array<String, Symbol>] methods Methods to delegate
8
- # @param [Symbol] to Method's name delegate to
9
- def delegate(*methods, to:)
10
- methods.each do |name|
11
- method_def = [
12
- "def #{name}(*args, &block)",
13
- " if !#{to}.nil?",
14
- " #{to}.#{name}(*args, &block)",
15
- " end",
16
- "end"
17
- ].join(";")
18
-
19
- module_eval(method_def)
20
- end
21
- end
22
- end