ciesta 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +14 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +90 -0
- data/LICENSE.txt +21 -0
- data/README.md +111 -0
- data/Rakefile +6 -0
- data/bin/console +10 -0
- data/bin/setup +8 -0
- data/ciesta.gemspec +41 -0
- data/lib/ciesta.rb +11 -0
- data/lib/ciesta/errors.rb +5 -0
- data/lib/ciesta/field.rb +27 -0
- data/lib/ciesta/form.rb +91 -0
- data/lib/ciesta/types.rb +5 -0
- data/lib/ciesta/validator.rb +20 -0
- data/lib/ciesta/version.rb +3 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0e648671453a91e2f62c7db71603ad9dbcea1606c2d5404fca7708a54a9a177a
|
4
|
+
data.tar.gz: 1067bcb0dc3b31f64090981b2ed4e9c0a102b02fd9aedca04c99114cb10ae8e4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4b2f569ade3113c3060f38bcecbc84063dcab3821d1237b0d6f95979dfdafd19ba3e5ca6590d635eb24726ef699d9399305677c95539b1fadd9b85e39cddc29c
|
7
|
+
data.tar.gz: 10aff7f55262f29b3983167f76f76fadb50e2a1f067b29e6a778e8204af173ac7b4abcbc299596f2cde405e71f9404842cd0dbe32efeeb2e77d22a9afe3e1339
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at alex.coder1@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ciesta (0.1.0)
|
5
|
+
dry-types (~> 0.12.1)
|
6
|
+
dry-validation (~> 0.11.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
coderay (1.1.2)
|
12
|
+
concurrent-ruby (1.0.5)
|
13
|
+
coveralls (0.8.21)
|
14
|
+
json (>= 1.8, < 3)
|
15
|
+
simplecov (~> 0.14.1)
|
16
|
+
term-ansicolor (~> 1.3)
|
17
|
+
thor (~> 0.19.4)
|
18
|
+
tins (~> 1.6)
|
19
|
+
diff-lcs (1.3)
|
20
|
+
docile (1.1.5)
|
21
|
+
dry-configurable (0.7.0)
|
22
|
+
concurrent-ruby (~> 1.0)
|
23
|
+
dry-container (0.6.0)
|
24
|
+
concurrent-ruby (~> 1.0)
|
25
|
+
dry-configurable (~> 0.1, >= 0.1.3)
|
26
|
+
dry-core (0.4.4)
|
27
|
+
concurrent-ruby (~> 1.0)
|
28
|
+
dry-equalizer (0.2.0)
|
29
|
+
dry-logic (0.4.2)
|
30
|
+
dry-container (~> 0.2, >= 0.2.6)
|
31
|
+
dry-core (~> 0.2)
|
32
|
+
dry-equalizer (~> 0.2)
|
33
|
+
dry-types (0.12.2)
|
34
|
+
concurrent-ruby (~> 1.0)
|
35
|
+
dry-configurable (~> 0.1)
|
36
|
+
dry-container (~> 0.3)
|
37
|
+
dry-core (~> 0.2, >= 0.2.1)
|
38
|
+
dry-equalizer (~> 0.2)
|
39
|
+
dry-logic (~> 0.4, >= 0.4.2)
|
40
|
+
inflecto (~> 0.0.0, >= 0.0.2)
|
41
|
+
dry-validation (0.11.1)
|
42
|
+
concurrent-ruby (~> 1.0)
|
43
|
+
dry-configurable (~> 0.1, >= 0.1.3)
|
44
|
+
dry-core (~> 0.2, >= 0.2.1)
|
45
|
+
dry-equalizer (~> 0.2)
|
46
|
+
dry-logic (~> 0.4, >= 0.4.0)
|
47
|
+
dry-types (~> 0.12.0)
|
48
|
+
inflecto (0.0.2)
|
49
|
+
json (2.1.0)
|
50
|
+
method_source (0.9.0)
|
51
|
+
pry (0.11.3)
|
52
|
+
coderay (~> 1.1.0)
|
53
|
+
method_source (~> 0.9.0)
|
54
|
+
rake (10.5.0)
|
55
|
+
rspec (3.7.0)
|
56
|
+
rspec-core (~> 3.7.0)
|
57
|
+
rspec-expectations (~> 3.7.0)
|
58
|
+
rspec-mocks (~> 3.7.0)
|
59
|
+
rspec-core (3.7.1)
|
60
|
+
rspec-support (~> 3.7.0)
|
61
|
+
rspec-expectations (3.7.0)
|
62
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
63
|
+
rspec-support (~> 3.7.0)
|
64
|
+
rspec-mocks (3.7.0)
|
65
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
66
|
+
rspec-support (~> 3.7.0)
|
67
|
+
rspec-support (3.7.1)
|
68
|
+
simplecov (0.14.1)
|
69
|
+
docile (~> 1.1.0)
|
70
|
+
json (>= 1.8, < 3)
|
71
|
+
simplecov-html (~> 0.10.0)
|
72
|
+
simplecov-html (0.10.2)
|
73
|
+
term-ansicolor (1.6.0)
|
74
|
+
tins (~> 1.0)
|
75
|
+
thor (0.19.4)
|
76
|
+
tins (1.16.3)
|
77
|
+
|
78
|
+
PLATFORMS
|
79
|
+
ruby
|
80
|
+
|
81
|
+
DEPENDENCIES
|
82
|
+
bundler (~> 1.16)
|
83
|
+
ciesta!
|
84
|
+
coveralls (~> 0.8)
|
85
|
+
pry (~> 0.11)
|
86
|
+
rake (~> 10.0)
|
87
|
+
rspec (~> 3.0)
|
88
|
+
|
89
|
+
BUNDLED WITH
|
90
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Alexey
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
# Ciesta
|
2
|
+
|
3
|
+
[![Coverage Status](https://coveralls.io/repos/github/nulldef/ciesta/badge.svg?branch=master)](https://coveralls.io/github/nulldef/ciesta?branch=master)
|
4
|
+
[![Build Status](https://travis-ci.org/nulldef/ciesta.svg?branch=master)](https://travis-ci.org/nulldef/ciesta)
|
5
|
+
|
6
|
+
Create simple form objects
|
7
|
+
|
8
|
+
Supported Ruby 2.2.0+
|
9
|
+
|
10
|
+
- [Installation](#installation)
|
11
|
+
- [Usage](#usage)
|
12
|
+
- [Basic usage](#basic-usage)
|
13
|
+
- [Assign values](#assign-values)
|
14
|
+
- [Syncing attributes](#syncing-attributes)
|
15
|
+
- [Types](#types)
|
16
|
+
- [Contributing](#contributing)
|
17
|
+
- [License](#license)
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Add this line to your application's Gemfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'ciesta'
|
25
|
+
```
|
26
|
+
|
27
|
+
And then execute:
|
28
|
+
|
29
|
+
$ bundle
|
30
|
+
|
31
|
+
Or install it yourself as:
|
32
|
+
|
33
|
+
$ gem install statum
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
### Basic usage
|
38
|
+
|
39
|
+
For validation it uses [dry-validation](https://github.com/dry-rb/dry-validation) under the hood. You can use all features of validation provided there.
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
User = Struct.new(:name, :age)
|
43
|
+
|
44
|
+
class Form < Ciesta::Form
|
45
|
+
field :name
|
46
|
+
field :age
|
47
|
+
|
48
|
+
validate do
|
49
|
+
required(:name).filled
|
50
|
+
required(:age).filled(gt?: 18)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
And use it
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
user = User.new("John", nil)
|
59
|
+
form = Form.new(user)
|
60
|
+
form.valid?(age: 10) # => false
|
61
|
+
form.valid?(age: 20) # => true
|
62
|
+
```
|
63
|
+
|
64
|
+
### Assign values
|
65
|
+
|
66
|
+
You can assign values to form with two methods `assign!` and `assign`
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
class Form < Ciesta::Form
|
70
|
+
field :bar
|
71
|
+
end
|
72
|
+
|
73
|
+
form.assign!(foo: 1, bar: 2) # => raises Ciesta::FieldNotDefined
|
74
|
+
...
|
75
|
+
form.assign(foo: 1, bar: 2)
|
76
|
+
form.foo # => 1
|
77
|
+
```
|
78
|
+
|
79
|
+
You can pass attributes directly to `valid?` method. In this case `assing` method will be used.
|
80
|
+
|
81
|
+
### Syncing attributes
|
82
|
+
|
83
|
+
You can use methods `sync` and `sync!` for mapping form values to the object. The difference is only that the second one will raise error if form is invalid.
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
form.valid?(age: 10)
|
87
|
+
form.sync! # => raises Ciesta::NotValid
|
88
|
+
form.sync # => returns nil
|
89
|
+
```
|
90
|
+
|
91
|
+
### Types
|
92
|
+
|
93
|
+
You can provide the type of each field for ciercing or checking one. All types provided by [dry-types](https://github.com/dry-rb/dry-types) but in gem's namespace.
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
class Form < Ciesta::Form
|
97
|
+
field :foo, type: Ciesta::Types::Coercible::String
|
98
|
+
end
|
99
|
+
|
100
|
+
# ...
|
101
|
+
form.assign(foo: 1) # => true
|
102
|
+
form.foo # => "1"
|
103
|
+
```
|
104
|
+
|
105
|
+
## Contributing
|
106
|
+
|
107
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/nulldef/ciesta](https://github.com/nulldef/ciesta).
|
108
|
+
|
109
|
+
## License
|
110
|
+
|
111
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
data/ciesta.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ciesta/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'ciesta'
|
8
|
+
spec.version = Ciesta::VERSION
|
9
|
+
spec.authors = ['Alexey']
|
10
|
+
spec.email = ['alex.coder1@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'Create form objects easy'
|
13
|
+
spec.description = 'Gem for creating and using form object'
|
14
|
+
spec.homepage = 'https://github.com/nulldef/ciesta'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
else
|
22
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
f.match(%r{^(test|spec|features)/})
|
27
|
+
end
|
28
|
+
spec.bindir = 'exe'
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ['lib']
|
31
|
+
spec.required_ruby_version = ">= 2.0"
|
32
|
+
|
33
|
+
spec.add_dependency 'dry-types', '~> 0.12.1'
|
34
|
+
spec.add_dependency 'dry-validation', '~> 0.11.1'
|
35
|
+
|
36
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
37
|
+
spec.add_development_dependency 'coveralls', '~> 0.8'
|
38
|
+
spec.add_development_dependency 'pry', '~> 0.11'
|
39
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
40
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
41
|
+
end
|
data/lib/ciesta.rb
ADDED
data/lib/ciesta/field.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
module Ciesta
|
2
|
+
class Field
|
3
|
+
DEFAULT_TYPE = Ciesta::Types::Any
|
4
|
+
|
5
|
+
attr_accessor :name, :type
|
6
|
+
|
7
|
+
def initialize(name, options)
|
8
|
+
self.name = name.to_sym
|
9
|
+
self.type = options.delete(:type) || DEFAULT_TYPE
|
10
|
+
self.value = options.delete(:default)
|
11
|
+
end
|
12
|
+
|
13
|
+
def value
|
14
|
+
current_value
|
15
|
+
end
|
16
|
+
|
17
|
+
def value=(val)
|
18
|
+
self.current_value = type[val]
|
19
|
+
rescue Dry::Types::ConstraintError
|
20
|
+
raise ViolatesConstraints, "#{current_value} is not a #{type.name}"
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_accessor :current_value
|
26
|
+
end
|
27
|
+
end
|
data/lib/ciesta/form.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
module Ciesta
|
2
|
+
class Form
|
3
|
+
def self.field(name, options = {})
|
4
|
+
name = name.to_sym
|
5
|
+
fields[name] ||= Ciesta::Field.new(name, options)
|
6
|
+
|
7
|
+
define_method(name) { self.class.fields[name].value }
|
8
|
+
define_method("#{name}=") { |value| self.class.fields[name].value = value }
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.validate(&block)
|
12
|
+
validator.use(&block)
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_accessor :object
|
16
|
+
|
17
|
+
def initialize(object)
|
18
|
+
self.object = object
|
19
|
+
|
20
|
+
obj_values = fields.keys.each_with_object({}) do |key, mem|
|
21
|
+
mem[key] = object.public_send(key)
|
22
|
+
end
|
23
|
+
|
24
|
+
assign(obj_values)
|
25
|
+
end
|
26
|
+
|
27
|
+
def valid?(params = nil)
|
28
|
+
assign(params) if params
|
29
|
+
validator.valid?(attributes)
|
30
|
+
end
|
31
|
+
|
32
|
+
def assign!(attributes)
|
33
|
+
attributes.each { |key, value| send("#{key}=", value) }
|
34
|
+
rescue NoMethodError => e
|
35
|
+
raise Ciesta::FieldNotDefined, e.message
|
36
|
+
end
|
37
|
+
|
38
|
+
def assign(params)
|
39
|
+
keys = fields.keys
|
40
|
+
params.keep_if { |key, _value| keys.include?(key) }
|
41
|
+
begin
|
42
|
+
assign!(params)
|
43
|
+
rescue StandardError
|
44
|
+
nil
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def errors
|
49
|
+
validator.errors
|
50
|
+
end
|
51
|
+
|
52
|
+
def sync!
|
53
|
+
raise Ciesta::NotValid, 'Form is not valid' unless errors.empty?
|
54
|
+
|
55
|
+
fields.each { |name, field| object.send("#{name}=", field.value) }
|
56
|
+
|
57
|
+
yield(object) if block_given?
|
58
|
+
true
|
59
|
+
end
|
60
|
+
|
61
|
+
def sync
|
62
|
+
sync!
|
63
|
+
rescue StandardError
|
64
|
+
nil
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def self.fields
|
70
|
+
@fields ||= {}
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.validator
|
74
|
+
@validator ||= Ciesta::Validator.new
|
75
|
+
end
|
76
|
+
|
77
|
+
def validator
|
78
|
+
self.class.validator
|
79
|
+
end
|
80
|
+
|
81
|
+
def fields
|
82
|
+
self.class.fields
|
83
|
+
end
|
84
|
+
|
85
|
+
def attributes
|
86
|
+
fields.values.each_with_object({}) do |field, mem|
|
87
|
+
mem[field.name] = field.value
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
data/lib/ciesta/types.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Ciesta
|
2
|
+
class Validator
|
3
|
+
attr_accessor :schema, :errors
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
self.errors = []
|
7
|
+
end
|
8
|
+
|
9
|
+
def use(&block)
|
10
|
+
self.schema = Dry::Validation.Form(&block)
|
11
|
+
end
|
12
|
+
|
13
|
+
def valid?(attributes)
|
14
|
+
return true if schema.nil?
|
15
|
+
|
16
|
+
self.errors = schema.call(attributes).errors
|
17
|
+
errors.empty?
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ciesta
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexey
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dry-types
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.12.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.12.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dry-validation
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.11.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.11.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.16'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.16'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.11'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.11'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
description: Gem for creating and using form object
|
112
|
+
email:
|
113
|
+
- alex.coder1@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- ".travis.yml"
|
121
|
+
- CODE_OF_CONDUCT.md
|
122
|
+
- Gemfile
|
123
|
+
- Gemfile.lock
|
124
|
+
- LICENSE.txt
|
125
|
+
- README.md
|
126
|
+
- Rakefile
|
127
|
+
- bin/console
|
128
|
+
- bin/setup
|
129
|
+
- ciesta.gemspec
|
130
|
+
- lib/ciesta.rb
|
131
|
+
- lib/ciesta/errors.rb
|
132
|
+
- lib/ciesta/field.rb
|
133
|
+
- lib/ciesta/form.rb
|
134
|
+
- lib/ciesta/types.rb
|
135
|
+
- lib/ciesta/validator.rb
|
136
|
+
- lib/ciesta/version.rb
|
137
|
+
homepage: https://github.com/nulldef/ciesta
|
138
|
+
licenses:
|
139
|
+
- MIT
|
140
|
+
metadata: {}
|
141
|
+
post_install_message:
|
142
|
+
rdoc_options: []
|
143
|
+
require_paths:
|
144
|
+
- lib
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '2.0'
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
requirements: []
|
156
|
+
rubyforge_project:
|
157
|
+
rubygems_version: 2.7.3
|
158
|
+
signing_key:
|
159
|
+
specification_version: 4
|
160
|
+
summary: Create form objects easy
|
161
|
+
test_files: []
|