atacama 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/Rakefile +2 -2
- data/lib/atacama/contract.rb +5 -6
- data/lib/atacama/transaction/definition.rb +0 -4
- data/lib/atacama/transaction.rb +1 -0
- data/lib/atacama/values.rb +1 -1
- data/lib/atacama/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57d7c04c5890cdf6985a82af71ac69e32739a3eb
|
4
|
+
data.tar.gz: 891d78acb5338faf7785095d141428805e7bc292
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43c1eeb7e3f30baf02bd20439e13524d5ee945a85cb6445ec6458d4578341d64a8e0def14361e3c13794a25616b0784822360c19da0fef5c046cec2425059735
|
7
|
+
data.tar.gz: d656e76622ecff876f02f9b826dc112fe38adea3f5ae444945f4bbde08a60381a9cfa53b8f4e5b5434b19c865eb3d48090ea19d0a989c060f655f01f11dd8b2e
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
atacama (0.1.
|
4
|
+
atacama (0.1.1)
|
5
5
|
dry-types (~> 0.13.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
concurrent-ruby (1.
|
10
|
+
concurrent-ruby (1.0.5)
|
11
11
|
dry-configurable (0.7.0)
|
12
12
|
concurrent-ruby (~> 1.0)
|
13
13
|
dry-container (0.6.0)
|
data/Rakefile
CHANGED
@@ -9,6 +9,6 @@ end
|
|
9
9
|
|
10
10
|
task default: :test
|
11
11
|
|
12
|
-
task :
|
13
|
-
exec 'docker run -v `pwd`:/app:cached -it spatialnetworks/alpine bash -l -c "gem install rerun && bundle &&
|
12
|
+
task :watch do
|
13
|
+
exec 'docker run -v `pwd`:/app:cached -it spatialnetworks/alpine bash -l -c "gem install rerun && bundle && /usr/local/bundle/bin/rerun -x rake"'
|
14
14
|
end
|
data/lib/atacama/contract.rb
CHANGED
@@ -9,14 +9,16 @@ module Atacama
|
|
9
9
|
module Types
|
10
10
|
include Dry::Types.module
|
11
11
|
Boolean = Types::True | Types::False
|
12
|
-
ContextOrHash = Strict::Hash | Instance(Context)
|
13
12
|
end
|
14
13
|
|
15
14
|
# This class enables a DSL for creating a contract for the initializer
|
16
15
|
class Contract
|
17
16
|
RESERVED_KEYS = %i[call initialize context].freeze
|
18
17
|
|
18
|
+
Types = Atacama::Types
|
19
|
+
|
19
20
|
NameInterface = Types::Strict::Symbol.constrained(excluded_from: RESERVED_KEYS)
|
21
|
+
ContextInterface = Types::Strict::Hash | Types.Instance(Context)
|
20
22
|
|
21
23
|
class << self
|
22
24
|
def options
|
@@ -26,9 +28,7 @@ module Atacama
|
|
26
28
|
# Define an initializer value.
|
27
29
|
# @param [Symbol] name of the argument
|
28
30
|
def option(name, **kwargs)
|
29
|
-
# Validate
|
30
|
-
name = NameInterface[name]
|
31
|
-
|
31
|
+
NameInterface[name] # Validate type
|
32
32
|
options[name] = Parameter.new(name: name, **kwargs)
|
33
33
|
|
34
34
|
define_method(name) { @context[name] }
|
@@ -43,8 +43,7 @@ module Atacama
|
|
43
43
|
attr_reader :context
|
44
44
|
|
45
45
|
def initialize(context: {}, **)
|
46
|
-
# Validate the type
|
47
|
-
Types::ContextOrHash[context]
|
46
|
+
ContextInterface[context] # Validate the type
|
48
47
|
@context = context.is_a?(Context) ? context : Context.new(context)
|
49
48
|
Validator.call(options: self.class.options, context: @context)
|
50
49
|
end
|
data/lib/atacama/transaction.rb
CHANGED
data/lib/atacama/values.rb
CHANGED
data/lib/atacama/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atacama
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Johnston
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-types
|