instructor 0.10.1 → 0.10.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: 2cd00ebac302eeb7cfa5c285a0b52b0743b71c4f2f68f26ec3f6e4a002afd5d3
4
- data.tar.gz: 25287b9950c2cdc587c14fb470c9aee52541e250e194798c262e1c974cbe9331
3
+ metadata.gz: 992b8c2f314c7e4554d7bde50f250944b6c1d19e1d8131d2c3094713829656d5
4
+ data.tar.gz: a56ca45c13c3e97ecaf33dcb0308ee387b4841755f53547156053ec1a23584fd
5
5
  SHA512:
6
- metadata.gz: b5866652fa837154d5fa1584ec92428f31b5b0a743bc31345a9222bfbd37cc172737ddd88e112e81d6b0787723ab0f635b98626d9c582d8742094005c73f58a8
7
- data.tar.gz: 2f97342b9f42834d222266de864a7cf0af00537fa5c79eb75cda9e3b140f77a0a6e17943d2aa6a597ecca667af98898a6a17ae9024e596299306a6f5ad0d7951
6
+ metadata.gz: 243d36cf47340dff1ce84bcb7afb31395780cefe7559c2e8c657dd22372fb649a7a349ce6bb653ad65e459c16e37a3e3b86ce4a0b0bb69e620888f8c4d5d2e76
7
+ data.tar.gz: a53aa80dd9c74c3c101204e272d8b4044ba29e5be8a3b017d5fba33ed03cdf6868a82fa48c8b93fcd07363b3ab22d9b5521a866b4587df8365871f882f8d0cb1
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "concerns/callbacks"
4
- require_relative "concerns/defaults"
5
4
  require_relative "concerns/attributes"
6
5
  require_relative "concerns/arguments"
7
6
  require_relative "concerns/options"
@@ -14,8 +13,8 @@ module Instructor
14
13
  include ActiveModel::Model
15
14
  include ActiveModel::Validations::Callbacks
16
15
  include Tablesalt::StringableObject
16
+ include Tablesalt::Dsl::Defaults
17
17
  include Instructor::Callbacks
18
- include Instructor::Defaults
19
18
  include Instructor::Attributes
20
19
  include Instructor::Arguments
21
20
  include Instructor::Options
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Instructor
4
4
  # This constant is managed by spicerack
5
- VERSION = "0.10.1"
5
+ VERSION = "0.10.2"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instructor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Garside
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-23 00:00:00.000000000 Z
11
+ date: 2019-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 5.2.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: tablesalt
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.10.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.10.2
41
55
  description: Input structure base object for capturing and validating input with a
42
56
  nice DSL
43
57
  email:
@@ -54,7 +68,6 @@ files:
54
68
  - lib/instructor/concerns/attributes.rb
55
69
  - lib/instructor/concerns/callbacks.rb
56
70
  - lib/instructor/concerns/core.rb
57
- - lib/instructor/concerns/defaults.rb
58
71
  - lib/instructor/concerns/options.rb
59
72
  - lib/instructor/custom_matchers.rb
60
73
  - lib/instructor/custom_matchers/define_argument.rb
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Defaults allow attributes to be initialized with a value if none have been provided.
4
- module Instructor
5
- module Defaults
6
- extend ActiveSupport::Concern
7
-
8
- included do
9
- class_attribute :_defaults, instance_writer: false, default: {}
10
- end
11
-
12
- class_methods do
13
- def inherited(base)
14
- dup = _defaults.dup
15
- base._defaults = dup.each { |k, v| dup[k] = v.dup }
16
- super
17
- end
18
-
19
- private
20
-
21
- def define_default(attribute, static: nil, &block)
22
- _defaults[attribute] = Value.new(static: static, &block)
23
- end
24
- end
25
-
26
- class Value
27
- def initialize(static: nil, &block)
28
- @value = (static.nil? && block_given?) ? block : static
29
- end
30
-
31
- def value
32
- (@value.respond_to?(:call) ? instance_eval(&@value) : @value).dup
33
- end
34
- end
35
- end
36
- end