that_object_is_so_basic 0.0.3 → 0.0.4
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 +4 -4
- data/.rubocop.yml +56 -0
- data/lib/toisb/version.rb +1 -1
- data/lib/toisb/wrapper.rb +12 -3
- data/uspec/wrapper_spec.rb +12 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d70e81573066f449fdfe140c9d0bde90e50e1b893003496531cd4a1259a83570
|
4
|
+
data.tar.gz: c009ebb990e7afba8586ff5004ca882901497deb6caf0920e3fe8daefe105b55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd66e59107d25c71448709ca9a41be9e1978693c71f7bf6730fe8e3a4618be0d7c091e9a2ba69266db22f8db715801455980d2ed218476d59a7573035ac3212b
|
7
|
+
data.tar.gz: 8286f9a068be52d055806aef6b5362e049d3148bb67aaeb2df20b470ba797bc246ee1eb8812782a623fa5f7aaa924399a9c4619da7bde4f357750727ce2c56d0
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Rubocop override settings
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.0
|
5
|
+
|
6
|
+
Metrics/LineLength:
|
7
|
+
Max: 120
|
8
|
+
Exclude:
|
9
|
+
- config_module.gemspec
|
10
|
+
- "uspec/**/*"
|
11
|
+
|
12
|
+
Naming/PredicateName:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Style/PreferredHashMethods:
|
16
|
+
Exclude:
|
17
|
+
- "**/*"
|
18
|
+
|
19
|
+
Style/Documentation:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Style/MethodDefParentheses:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/ParallelAssignment:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Style/SingleLineMethods:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Style/Alias:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/CaseEquality:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Style/SymbolArray:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Bundler/OrderedGems:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Style/StringLiterals:
|
44
|
+
EnforcedStyle: double_quotes
|
45
|
+
|
46
|
+
Style/StringLiteralsInInterpolation:
|
47
|
+
EnforcedStyle: double_quotes
|
48
|
+
|
49
|
+
Layout/AccessModifierIndentation:
|
50
|
+
EnforcedStyle: outdent
|
51
|
+
|
52
|
+
Style/EnforcedStyleForMultiline:
|
53
|
+
EnforcedStyle: consistent_comma
|
54
|
+
|
55
|
+
Naming/RescuedExceptionsVariableName:
|
56
|
+
PreferredName: error
|
data/lib/toisb/version.rb
CHANGED
data/lib/toisb/wrapper.rb
CHANGED
@@ -7,10 +7,19 @@ module TOISB; class Wrapper
|
|
7
7
|
|
8
8
|
# Checks for an inspect method and falls back to Superclass/Class:ID
|
9
9
|
def inspector
|
10
|
-
|
11
|
-
klass && klass.public_method_defined?(:inspect) ? object.inspect : fallback
|
10
|
+
inspector!
|
12
11
|
rescue
|
13
|
-
|
12
|
+
simple_inspector
|
13
|
+
end
|
14
|
+
|
15
|
+
# This version doesn't rescue when #inspect raises
|
16
|
+
def inspector!
|
17
|
+
klass && klass.public_method_defined?(:inspect) ? object.inspect : simple_inspector
|
18
|
+
end
|
19
|
+
|
20
|
+
# Simple inspect-ish output with a low chance of failure
|
21
|
+
def simple_inspector
|
22
|
+
"#<#{superklass}/#{klass}:0x#{get_id}>"
|
14
23
|
end
|
15
24
|
|
16
25
|
# Obtain the singleton class of an object
|
data/uspec/wrapper_spec.rb
CHANGED
@@ -47,3 +47,15 @@ spec "can get the ancestors of a BasicObject subclass" do
|
|
47
47
|
actual.size == expected || actual
|
48
48
|
end
|
49
49
|
|
50
|
+
spec "#inspector! doesn't mask exceptions if the associated inspect method fails" do
|
51
|
+
class ::FailingInspectObject < BasicObject
|
52
|
+
def inspect; ::Kernel.raise ::NotImplementedError, "This is supposed to fail"; end;
|
53
|
+
end
|
54
|
+
inspect_fail = TOISB.wrap ::FailingInspectObject.new
|
55
|
+
|
56
|
+
begin
|
57
|
+
inspect_fail.inspector!
|
58
|
+
rescue NotImplementedError => error
|
59
|
+
error.message.include?("supposed to fail") || error
|
60
|
+
end
|
61
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: that_object_is_so_basic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony M. Cook
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uspec
|
@@ -61,6 +61,7 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- ".editorconfig"
|
63
63
|
- ".gitignore"
|
64
|
+
- ".rubocop.yml"
|
64
65
|
- ".ruby-version"
|
65
66
|
- ".travis.yml"
|
66
67
|
- Gemfile
|