mixins 0.1.0.pre.20250527171116

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.
@@ -0,0 +1,98 @@
1
+ # -*- ruby -*-
2
+
3
+ require_relative '../spec_helper'
4
+
5
+ require 'mixins'
6
+
7
+
8
+ RSpec.describe( Mixins::MethodUtilities ) do
9
+
10
+ let!( :extended_class ) do
11
+ klass = Class.new
12
+ klass.extend( Mixins::MethodUtilities )
13
+ klass
14
+ end
15
+
16
+
17
+ it "can declare a class-level attribute reader" do
18
+ extended_class.singleton_attr_reader :foo
19
+ expect( extended_class ).to respond_to( :foo )
20
+ expect( extended_class ).to_not respond_to( :foo= )
21
+ expect( extended_class ).to_not respond_to( :foo? )
22
+ end
23
+
24
+
25
+ it "can declare a class-level attribute writer" do
26
+ extended_class.singleton_attr_writer :foo
27
+ expect( extended_class ).to_not respond_to( :foo )
28
+ expect( extended_class ).to respond_to( :foo= )
29
+ expect( extended_class ).to_not respond_to( :foo? )
30
+ end
31
+
32
+
33
+ it "can declare a class-level attribute reader and writer" do
34
+ extended_class.singleton_attr_accessor :foo
35
+ expect( extended_class ).to respond_to( :foo )
36
+ expect( extended_class ).to respond_to( :foo= )
37
+ expect( extended_class ).to_not respond_to( :foo? )
38
+ end
39
+
40
+
41
+ it "can declare a class-level alias" do
42
+ def extended_class.foo
43
+ return "foo"
44
+ end
45
+ extended_class.singleton_method_alias( :bar, :foo )
46
+
47
+ expect( extended_class.bar ).to eq( 'foo' )
48
+ end
49
+
50
+
51
+ it "can declare an instance attribute predicate method" do
52
+ extended_class.attr_predicate :foo
53
+ instance = extended_class.new
54
+
55
+ expect( instance ).to_not respond_to( :foo )
56
+ expect( instance ).to_not respond_to( :foo= )
57
+ expect( instance ).to respond_to( :foo? )
58
+
59
+ expect( instance.foo? ).to be_falsey
60
+
61
+ instance.instance_variable_set( :@foo, 1 )
62
+ expect( instance.foo? ).to be_truthy
63
+ end
64
+
65
+
66
+ it "can declare an instance attribute predicate and writer" do
67
+ extended_class.attr_predicate_accessor :foo
68
+ instance = extended_class.new
69
+
70
+ expect( instance ).to_not respond_to( :foo )
71
+ expect( instance ).to respond_to( :foo= )
72
+ expect( instance ).to respond_to( :foo? )
73
+
74
+ expect( instance.foo? ).to be_falsey
75
+
76
+ instance.foo = 1
77
+ expect( instance.foo? ).to be_truthy
78
+ end
79
+
80
+
81
+ it "can declare a class-level attribute predicate and writer" do
82
+ extended_class.singleton_predicate_accessor :foo
83
+ expect( extended_class ).to_not respond_to( :foo )
84
+ expect( extended_class ).to respond_to( :foo= )
85
+ expect( extended_class ).to respond_to( :foo? )
86
+ end
87
+
88
+
89
+ it "can declare a class-level predicate method" do
90
+ extended_class.singleton_predicate_reader :foo
91
+ expect( extended_class ).to_not respond_to( :foo )
92
+ expect( extended_class ).to_not respond_to( :foo= )
93
+ expect( extended_class ).to respond_to( :foo? )
94
+ end
95
+
96
+ end
97
+
98
+
@@ -0,0 +1,32 @@
1
+ # -*- ruby -*-
2
+
3
+ require_relative 'spec_helper'
4
+
5
+ require 'rspec'
6
+ require 'mixins'
7
+
8
+ RSpec.describe( Mixins ) do
9
+
10
+ SEMVER_PATTERN = %r{
11
+ \A
12
+ \d+(?:\.\d+){2} # version; x.y.z
13
+ (?: # optional prerelease version
14
+ -
15
+ (?:[\w\-]+)
16
+ (?:\.[\w\-]+)
17
+ )?
18
+ (?: # optional build netadata
19
+ \+
20
+ (?:[\w\-]+)
21
+ (?:\.[\w\-]+)
22
+ )?
23
+ }x
24
+
25
+
26
+ it "has a semantic version in its VERSION constant" do
27
+ expect( described_class::VERSION ).to be_a( String )
28
+ expect( described_class::VERSION ).to match( SEMVER_PATTERN )
29
+ end
30
+
31
+ end
32
+
@@ -0,0 +1,25 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'simplecov' if ENV['COVERAGE']
4
+
5
+ require 'rspec'
6
+
7
+
8
+ ### Mock with RSpec
9
+ RSpec.configure do |config|
10
+ config.mock_with( :rspec ) do |mock|
11
+ mock.syntax = :expect
12
+ end
13
+
14
+ config.disable_monkey_patching!
15
+ config.example_status_persistence_file_path = "spec/.status"
16
+ config.filter_run :focus
17
+ config.filter_run_when_matching :focus
18
+ config.order = :random
19
+ config.profile_examples = 5
20
+ config.run_all_when_everything_filtered = true
21
+ config.shared_context_metadata_behavior = :apply_to_host_groups
22
+ # config.warnings = true
23
+ end
24
+
25
+
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mixins
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.pre.20250527171116
5
+ platform: ruby
6
+ authors:
7
+ - Michael Granger
8
+ bindir: bin
9
+ cert_chain:
10
+ - |
11
+ -----BEGIN CERTIFICATE-----
12
+ MIIEbDCCAtSgAwIBAgIBATANBgkqhkiG9w0BAQsFADA+MQwwCgYDVQQDDANnZWQx
13
+ GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
14
+ HhcNMjUwMTAxMDMzMTA5WhcNMjYwMTAxMDMzMTA5WjA+MQwwCgYDVQQDDANnZWQx
15
+ GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
16
+ ggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC/JWGRHO+USzR97vXjkFgt
17
+ 83qeNf2KHkcvrRTSnR64i6um/ziin0I0oX23H7VYrDJC9A/uoUa5nGRJS5Zw/+wW
18
+ ENcvWVZS4iUzi4dsYJGY6yEOsXh2CcF46+QevV8iE+UmbkU75V7Dy1JCaUOyizEt
19
+ TH5UHsOtUU7k9TYARt/TgYZKuaoAMZZd5qyVqhF1vV+7/Qzmp89NGflXf2xYP26a
20
+ 4MAX2qqKX/FKXqmFO+AGsbwYTEds1mksBF3fGsFgsQWxftG8GfZQ9+Cyu2+l1eOw
21
+ cZ+lPc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
39
+ - !ruby/object:Gem::Dependency
40
+ name: rake-deveiate
41
+ requirement: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - "~>"
44
+ - !ruby/object:Gem::Version
45
+ version: '0.10'
46
+ type: :development
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.10'
53
+ description: This is a collection of zero-dependency mixins. They’re intended to be
54
+ generically useful for building other software, well-tested, and not add any non-stdlib
55
+ dependencies.
56
+ email:
57
+ - ged@faeriemud.org
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - History.md
63
+ - LICENSE.txt
64
+ - README.md
65
+ - lib/mixins.rb
66
+ - lib/mixins/data_utilities.rb
67
+ - lib/mixins/datadir.rb
68
+ - lib/mixins/delegation.rb
69
+ - lib/mixins/hooks.rb
70
+ - lib/mixins/inspection.rb
71
+ - lib/mixins/method_utilities.rb
72
+ - spec/mixins/data_utilities_spec.rb
73
+ - spec/mixins/datadir_spec.rb
74
+ - spec/mixins/delegation_spec.rb
75
+ - spec/mixins/hooks_spec.rb
76
+ - spec/mixins/inspection_spec.rb
77
+ - spec/mixins/method_utilities_spec.rb
78
+ - spec/mixins_spec.rb
79
+ - spec/spec_helper.rb
80
+ homepage: https://hg.sr.ht/~ged/Mixins
81
+ licenses:
82
+ - BSD-3-Clause
83
+ metadata:
84
+ bug_tracker_uri: https://todo.sr.ht/~ged/Mixins
85
+ changelog_uri: https://deveiate.org/code/mixins/History_md.html
86
+ documentation_uri: https://deveiate.org/code/mixins
87
+ homepage_uri: https://hg.sr.ht/~ged/Mixins
88
+ source_uri: https://hg.sr.ht/~ged/Mixins
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubygems_version: 3.6.7
104
+ specification_version: 4
105
+ summary: This is a collection of zero-dependency mixins.
106
+ test_files: []
metadata.gz.sig ADDED
Binary file