hecks-validator 0.1.9

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 (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/hecks-validator.rb +33 -0
  3. metadata +44 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e2eb620e7f73308ca8aa84467acd0adae491a0c2
4
+ data.tar.gz: 39c0f7081e1de0fef2aff6c702a7b5a86cb70726
5
+ SHA512:
6
+ metadata.gz: 07b60217638414a0c511fe01391b32986ea131cf56cfc607aba5b1eb8fe1054f03eb55068e77a31f2eee0f10d70723f05c51ab1c6ba60718d5607c050aeed236
7
+ data.tar.gz: 958570bcc8d8a1cba528abce583ce5cd049f5d60cfaabcd28aa99859759f85819025d40679b3fe5f4d67b7d651282a8a9e1c7432b1f590d2ae6ace46eaf0848b
@@ -0,0 +1,33 @@
1
+ module Hecks
2
+ module Adapters
3
+ class Validator
4
+ attr_reader :errors
5
+
6
+ def initialize(command:)
7
+ @args = command.args
8
+ @head_spec = command.domain_module.head
9
+ @errors = {}
10
+ end
11
+
12
+ def call
13
+ validate
14
+ return self
15
+ end
16
+
17
+ private
18
+
19
+ attr_reader :args, :head_spec
20
+
21
+ def validate
22
+ (missing_attributes).each do |missing_attribute|
23
+ errors[missing_attribute] = []
24
+ errors[missing_attribute] << "missing"
25
+ end
26
+ end
27
+
28
+ def missing_attributes
29
+ head_spec.attribute_hash.keys - args.keys
30
+ end
31
+ end
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hecks-validator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.9
5
+ platform: ruby
6
+ authors:
7
+ - Chris Young
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-15 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Hecks Validator
14
+ email: chris@example.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/hecks-validator.rb
20
+ homepage: https://github.com/chrisyoung/hecks
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.6.10
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: A basic validator for Hecks Applications
44
+ test_files: []