mixins 0.1.0 → 0.3.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.md +14 -0
- data/lib/mixins/datadir.rb +3 -0
- data/lib/mixins/inspection.rb +18 -1
- data/lib/mixins.rb +1 -1
- data/spec/mixins/inspection_spec.rb +14 -1
- data/spec/spec_helper.rb +3 -1
- data.tar.gz.sig +0 -0
- metadata +29 -16
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 02b3858efde14f4da0fd5a66b55a25c323451a66a5beffa9e92605412f3aed46
|
|
4
|
+
data.tar.gz: 0b22e9561b1b2cbc6a2e54c49a9c31d9de21fe47bba9c4656ae616ba95d23c22
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 897d4fdd9f775accff1e442cda2714a0256f105ea0326e6bc71e2218a1b768bcc1f2072e1f70b3a1d747133dce5e41b83f9d8cdf272db7f2fa4e73fbd0650fb9
|
|
7
|
+
data.tar.gz: ac41d3a4e8d0226c9e598c773fca6890b1c5820be5ed9642af2952144ebbfcf5173a633d24503cf616b75f1342120f0b34d99b3504a33316352f0d03ffd56b75
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/History.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Release History for mixins
|
|
2
2
|
|
|
3
3
|
---
|
|
4
|
+
## v0.3.0 [2026-11-07] Michael Granger <ged@faeriemud.org>
|
|
5
|
+
|
|
6
|
+
Improvements:
|
|
7
|
+
|
|
8
|
+
- Improve Inspection so it works with no attributes
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## v0.2.0 [2026-04-14] Michael Granger <ged@faeriemud.org>
|
|
12
|
+
|
|
13
|
+
Improvements:
|
|
14
|
+
|
|
15
|
+
- Add datadir gem to work around breaking Rubygems change
|
|
16
|
+
|
|
17
|
+
|
|
4
18
|
## v0.1.0 [2025-07-12] Michael Granger <ged@faeriemud.org>
|
|
5
19
|
|
|
6
20
|
First release.
|
data/lib/mixins/datadir.rb
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
require 'pathname'
|
|
4
4
|
require 'rubygems'
|
|
5
|
+
require 'rubygems/datadir'
|
|
5
6
|
|
|
6
7
|
require 'mixins' unless defined?( Mixins )
|
|
7
8
|
|
|
9
|
+
using Gem::DataDirRefinements
|
|
10
|
+
|
|
8
11
|
|
|
9
12
|
# Adds a #data_dir method and a DATA_DIR constant to extended objects. These
|
|
10
13
|
# will be set to the `Pathname` to the data directory distributed with a gem of the
|
data/lib/mixins/inspection.rb
CHANGED
|
@@ -12,6 +12,21 @@ require 'mixins' unless defined?( Mixins )
|
|
|
12
12
|
# will cause #inspect to use the default output.
|
|
13
13
|
module Mixins::Inspection
|
|
14
14
|
|
|
15
|
+
# Figure out how long the object id in the default #inspect output is
|
|
16
|
+
OBJ_ID_WIDTH = begin
|
|
17
|
+
default = Kernel.instance_method( :inspect ).bind( Object.new ).call
|
|
18
|
+
default[ /0x(\h+)/, 1 ].length
|
|
19
|
+
rescue
|
|
20
|
+
8
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Make a pattern for the default object id in #inspect
|
|
24
|
+
OBJ_ID_HEX = /\h{#{OBJ_ID_WIDTH}}/
|
|
25
|
+
|
|
26
|
+
# Make a pattern for matching everything after the default object id
|
|
27
|
+
OBJ_INSPECT_SUFFIX = /(?<=0x#{OBJ_ID_HEX})(?: .*)?\>\z/
|
|
28
|
+
|
|
29
|
+
|
|
15
30
|
### Return a human-readable representation of the object suitable for debugging.
|
|
16
31
|
def inspect
|
|
17
32
|
details = self.inspect_details
|
|
@@ -19,7 +34,9 @@ module Mixins::Inspection
|
|
|
19
34
|
|
|
20
35
|
default = super
|
|
21
36
|
|
|
22
|
-
|
|
37
|
+
# #<Class:0x00000001097afd50>
|
|
38
|
+
# #<Class:0x00000001097afd50 @attribute=value>
|
|
39
|
+
return default.sub( OBJ_INSPECT_SUFFIX, details << '>' )
|
|
23
40
|
end
|
|
24
41
|
|
|
25
42
|
|
data/lib/mixins.rb
CHANGED
|
@@ -20,6 +20,19 @@ RSpec.describe( Mixins::Inspection ) do
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
it "adds details to an object with no attributes" do
|
|
24
|
+
oclass = Class.new do
|
|
25
|
+
def inspect_details
|
|
26
|
+
return " testoutput"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
oclass.include( described_class )
|
|
30
|
+
instance = oclass.new
|
|
31
|
+
|
|
32
|
+
expect( instance.inspect ).to match( /#<#{oclass.inspect}:0x\h+ testoutput>/ )
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
|
|
23
36
|
it "allows the inspection contents to be overridden" do
|
|
24
37
|
oclass = Class.new do
|
|
25
38
|
def initialize( serial )
|
|
@@ -38,7 +51,7 @@ RSpec.describe( Mixins::Inspection ) do
|
|
|
38
51
|
end
|
|
39
52
|
|
|
40
53
|
|
|
41
|
-
it "doesn't add a separator space if the details already
|
|
54
|
+
it "doesn't add a separator space if the details already begin with a space" do
|
|
42
55
|
oclass = Class.new do
|
|
43
56
|
def initialize( serial )
|
|
44
57
|
@serial = serial
|
data/spec/spec_helper.rb
CHANGED
|
@@ -9,6 +9,8 @@ require 'rspec'
|
|
|
9
9
|
RSpec.configure do |config|
|
|
10
10
|
config.mock_with( :rspec ) do |mock|
|
|
11
11
|
mock.syntax = :expect
|
|
12
|
+
mock.verify_doubled_constant_names = true
|
|
13
|
+
mock.verify_partial_doubles = true
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
config.disable_monkey_patching!
|
|
@@ -19,7 +21,7 @@ RSpec.configure do |config|
|
|
|
19
21
|
config.profile_examples = 5
|
|
20
22
|
config.run_all_when_everything_filtered = true
|
|
21
23
|
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
22
|
-
|
|
24
|
+
config.warnings = true
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mixins
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Granger
|
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
|
10
10
|
cert_chain:
|
|
11
11
|
- |
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
|
13
|
-
|
|
13
|
+
MIIEMDCCApigAwIBAgIBAjANBgkqhkiG9w0BAQsFADA+MQwwCgYDVQQDDANnZWQx
|
|
14
14
|
GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
|
15
|
-
|
|
15
|
+
HhcNMjYwMjAyMjExMjQ0WhcNMjcwMjAyMjExMjQ0WjA+MQwwCgYDVQQDDANnZWQx
|
|
16
16
|
GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
|
17
17
|
ggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC/JWGRHO+USzR97vXjkFgt
|
|
18
18
|
83qeNf2KHkcvrRTSnR64i6um/ziin0I0oX23H7VYrDJC9A/uoUa5nGRJS5Zw/+wW
|
|
@@ -22,21 +22,34 @@ cert_chain:
|
|
|
22
22
|
cZ+lPcg834G9DrqW2zhqUoLr1MTly4pqxYGb7XoDhoR7dd1kFE2a067+DzWC/ADt
|
|
23
23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CWAz/6ZnDF8GS7EK1bOfM+YWqJL30g7PoxpT+UJTqWJtM
|
|
35
|
+
CCC1LSoBD7OEUiaIMWUo4h7xWIs=
|
|
37
36
|
-----END CERTIFICATE-----
|
|
38
|
-
date:
|
|
37
|
+
date: 2026-11-07 00:00:00.000000000 Z
|
|
39
38
|
dependencies:
|
|
39
|
+
- !ruby/object:Gem::Dependency
|
|
40
|
+
name: rubygems-datadir
|
|
41
|
+
requirement: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - "~>"
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0.0'
|
|
46
|
+
type: :runtime
|
|
47
|
+
prerelease: false
|
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - "~>"
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '0.0'
|
|
40
53
|
- !ruby/object:Gem::Dependency
|
|
41
54
|
name: rake-deveiate
|
|
42
55
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -102,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
102
115
|
- !ruby/object:Gem::Version
|
|
103
116
|
version: '0'
|
|
104
117
|
requirements: []
|
|
105
|
-
rubygems_version:
|
|
118
|
+
rubygems_version: 4.0.20
|
|
106
119
|
specification_version: 4
|
|
107
120
|
summary: This is a collection of zero-dependency mixins.
|
|
108
121
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|