instructor 0.9.5 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/instructor/base.rb +1 -2
- data/lib/instructor/concerns/attributes.rb +6 -0
- data/lib/instructor/version.rb +1 -1
- data/lib/instructor.rb +2 -0
- metadata +2 -3
- data/lib/instructor/concerns/string.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00d64c0d81969735c570992e5467c0f0d39657ac237c324f64c8b5139fc914d1
|
4
|
+
data.tar.gz: 47a9c9cc96860ad4e9fcda15c3c57c0e5e0ba6ed5915590e9e1fcfd996aa50b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04640c4f8f7390e0d773b8ba00b9953d83441ed7f53e4517851c3f4db24a421874b4d9ca531a897fffcdd7e595de67c9893c5d1039820bd2b468f5b6a6c6996f
|
7
|
+
data.tar.gz: 90743c22d61f87807a5ee4d799a65bcd6ef1fdce1c417304ebd8060bd006ecfd87056b77e27e54c91f97f308409aeb2ea580c5ca4770571700245dbdaceb1228
|
data/lib/instructor/base.rb
CHANGED
@@ -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
|
data/lib/instructor/version.rb
CHANGED
data/lib/instructor.rb
CHANGED
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.
|
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-
|
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
|