instructor 0.9.5 → 0.10.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cc57cfeb2326c5cf09fab05b02a3c91f6f5749c76bf64ec6b4eafc080d0c83b
4
- data.tar.gz: c7a5f435ddd101bc361d8210373972ed8a7e90c804103666f293ab37ec638d5c
3
+ metadata.gz: 00d64c0d81969735c570992e5467c0f0d39657ac237c324f64c8b5139fc914d1
4
+ data.tar.gz: 47a9c9cc96860ad4e9fcda15c3c57c0e5e0ba6ed5915590e9e1fcfd996aa50b4
5
5
  SHA512:
6
- metadata.gz: db7c1efaa9230b6cc5c15f8a5a8a8279a35bba3966606750a1d9854567c5f05200753b36f1cbcceb50f0cf58064a209df881c8f62efc31cdde0ff2e3618c0c98
7
- data.tar.gz: 395d726c54ae39b9bd55e887ed84af8b63e59f105924916ce5eb3eacd8a26797fba69f6397cb4e4ca15675e8cee7e99868461bc63f755c8cb6e45aba017c8088
6
+ metadata.gz: 04640c4f8f7390e0d773b8ba00b9953d83441ed7f53e4517851c3f4db24a421874b4d9ca531a897fffcdd7e595de67c9893c5d1039820bd2b468f5b6a6c6996f
7
+ data.tar.gz: 90743c22d61f87807a5ee4d799a65bcd6ef1fdce1c417304ebd8060bd006ecfd87056b77e27e54c91f97f308409aeb2ea580c5ca4770571700245dbdaceb1228
@@ -6,7 +6,6 @@ require_relative "concerns/attributes"
6
6
  require_relative "concerns/arguments"
7
7
  require_relative "concerns/options"
8
8
  require_relative "concerns/core"
9
- require_relative "concerns/string"
10
9
 
11
10
  module Instructor
12
11
  class Base
@@ -14,12 +13,12 @@ module Instructor
14
13
  include Technologic
15
14
  include ActiveModel::Model
16
15
  include ActiveModel::Validations::Callbacks
16
+ include Tablesalt::StringableObject
17
17
  include Instructor::Callbacks
18
18
  include Instructor::Defaults
19
19
  include Instructor::Attributes
20
20
  include Instructor::Arguments
21
21
  include Instructor::Options
22
22
  include Instructor::Core
23
- include Instructor::String
24
23
  end
25
24
  end
@@ -27,5 +27,11 @@ module Instructor
27
27
  end
28
28
  alias_method :attribute, :define_attribute
29
29
  end
30
+
31
+ private
32
+
33
+ def stringable_attributes
34
+ self.class._attributes
35
+ end
30
36
  end
31
37
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Instructor
4
4
  # This constant is managed by spicerack
5
- VERSION = "0.9.5"
5
+ VERSION = "0.10.0"
6
6
  end
data/lib/instructor.rb CHANGED
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_support"
4
+ require "active_support/inflector"
4
5
  require "active_model"
5
6
 
6
7
  require "short_circu_it"
8
+ require "tablesalt"
7
9
  require "technologic"
8
10
 
9
11
  require "instructor/version"
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.9.5
4
+ version: 0.10.0
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-20 00:00:00.000000000 Z
11
+ date: 2019-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -56,7 +56,6 @@ files:
56
56
  - lib/instructor/concerns/core.rb
57
57
  - lib/instructor/concerns/defaults.rb
58
58
  - lib/instructor/concerns/options.rb
59
- - lib/instructor/concerns/string.rb
60
59
  - lib/instructor/custom_matchers.rb
61
60
  - lib/instructor/custom_matchers/define_argument.rb
62
61
  - lib/instructor/custom_matchers/define_attribute.rb
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Formats the Instructor as a string.
4
- module Instructor
5
- module String
6
- extend ActiveSupport::Concern
7
-
8
- def to_s
9
- string_for(__method__)
10
- end
11
-
12
- def inspect
13
- string_for(__method__)
14
- end
15
-
16
- private
17
-
18
- def stringable_attributes
19
- self.class._attributes
20
- end
21
-
22
- def string_for(method)
23
- "#<#{self.class.name} #{attribute_string(method)}>"
24
- end
25
-
26
- def attribute_string(method)
27
- stringable_attribute_values.map { |attribute, value| "#{attribute}=#{value.public_send(method)}" }.join(" ")
28
- end
29
-
30
- def stringable_attribute_values
31
- stringable_attributes.each_with_object({}) { |attribute, result| result[attribute] = safe_send(attribute) }
32
- end
33
-
34
- def safe_send(method)
35
- public_send(method)
36
- rescue StandardError
37
- nil
38
- end
39
- end
40
- end