that_object_is_so_basic 0.0.4 → 0.0.5

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: d70e81573066f449fdfe140c9d0bde90e50e1b893003496531cd4a1259a83570
4
- data.tar.gz: c009ebb990e7afba8586ff5004ca882901497deb6caf0920e3fe8daefe105b55
3
+ metadata.gz: 8be7b4a1087d0056cc8d2df54495cc2bb7cf48d6596882fc2caca31be68f50d9
4
+ data.tar.gz: c7390074074b3c5731a7caf870b3de1a55d07930c6bc3f9b0bf17d4fa1ee49a0
5
5
  SHA512:
6
- metadata.gz: cd66e59107d25c71448709ca9a41be9e1978693c71f7bf6730fe8e3a4618be0d7c091e9a2ba69266db22f8db715801455980d2ed218476d59a7573035ac3212b
7
- data.tar.gz: 8286f9a068be52d055806aef6b5362e049d3148bb67aaeb2df20b470ba797bc246ee1eb8812782a623fa5f7aaa924399a9c4619da7bde4f357750727ce2c56d0
6
+ metadata.gz: 5868ebf2199362ea9b57c80a741930fa78f76569aad23c17facd9c96b93daa9c08ef9ff10e4db786117082003419f2171d2870e0d88e11f8e814f73e83234a1f
7
+ data.tar.gz: 472d1a89f3cb15c5cf2df1fb973c43d085385216acd9f875a357cb38e1adc1c4853ba58697bba48933a3219302ed19fbe921c54cd9e9f0918307ff78372c68b8
data/lib/toisb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module TOISB
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/toisb/wrapper.rb CHANGED
@@ -19,7 +19,19 @@ module TOISB; class Wrapper
19
19
 
20
20
  # Simple inspect-ish output with a low chance of failure
21
21
  def simple_inspector
22
- "#<#{superklass}/#{klass}:0x#{get_id}>"
22
+ "#<#{klassinfo}:0x#{get_id}>"
23
+ end
24
+
25
+ # show a nicely formated version of the class and its superclass
26
+ # displays it in the style of a path, with the superclass as the parent directory
27
+ def klassinfo
28
+ [superklass, klass].compact.join "/"
29
+ end
30
+
31
+ # show a nicely formated version of the class and its superclass
32
+ # displays it in the same style as the class definition
33
+ def subklassinfo
34
+ [klass, superklass].compact.join " < "
23
35
  end
24
36
 
25
37
  # Obtain the singleton class of an object
@@ -4,6 +4,8 @@ class ::TestObject < BasicObject; end
4
4
  obj = ::TestObject.new
5
5
  toisb = TOISB.wrap obj
6
6
 
7
+ bowrap = TOISB.wrap BasicObject.new
8
+
7
9
  spec "can inspect BasicObject subclasses" do
8
10
  expected = "BasicObject/TestObject"
9
11
  actual = toisb.inspector
@@ -37,7 +39,7 @@ end
37
39
 
38
40
  spec "can get the superclass (nil) of a BasicObject" do
39
41
  expected = nil
40
- actual = TOISB.wrap(BasicObject.new).superklass
42
+ actual = bowrap.superklass
41
43
  actual == expected || actual
42
44
  end
43
45
 
@@ -59,3 +61,27 @@ spec "#inspector! doesn't mask exceptions if the associated inspect method fails
59
61
  error.message.include?("supposed to fail") || error
60
62
  end
61
63
  end
64
+
65
+ spec "generates correct klassinfo for BasicObject" do
66
+ expected = "BasicObject"
67
+ actual = bowrap.klassinfo
68
+ actual == expected || actual
69
+ end
70
+
71
+ spec "generates correct subklassinfo for BasicObject" do
72
+ expected = "BasicObject"
73
+ actual = bowrap.subklassinfo
74
+ actual == expected || actual
75
+ end
76
+
77
+ spec "generates correct klassinfo for BasicObject subclasses" do
78
+ expected = "BasicObject/TestObject"
79
+ actual = toisb.klassinfo
80
+ actual == expected || actual
81
+ end
82
+
83
+ spec "generates correct subklassinfo for BasicObject subclasses" do
84
+ expected = "TestObject < BasicObject"
85
+ actual = toisb.subklassinfo
86
+ actual == expected || actual
87
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
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
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony M. Cook