inclusive 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e972fc6385483574fb08cfcc3a4cf320b162b8e7bd726a1074e917a308114bc
4
- data.tar.gz: 6d1fed490b2da13b72acaaa16ebacaea3623fdd4d98904523ee8e6d6f7428ef7
3
+ metadata.gz: ddc29ec0efef46b8a13bfc7a1d4012928ea69918692e8901af90d841a352f830
4
+ data.tar.gz: 19318553d2e8204bdf1d46675f1f3325582bc8aedd04eba8f02102f082d31860
5
5
  SHA512:
6
- metadata.gz: 22c5f46c10692394cff02977e1017b84009ff19f268357703b84c3ce1c2d06ca4c5f8a839dcedf98cb9dfeedb7a0f070bd27ef923df0bebcb57977cabc5bd4cc
7
- data.tar.gz: 9e22d54b55eb4c10ecac7b1c5962dca0772ec66a06d3728e22a06a1c663afbf971524095b1516fb7ec80cc9bb3429cb9c5346f7711af3aaf2c1f57c25e8404f7
6
+ metadata.gz: da061549c1075f7734b3c5a4283b9e8df8fc9f668fc74cbe547e98e8a451c889aea9a10cf1e8f6e31197d54650ae6386605bd0c47e718a6fb661f5799e0fb0f3
7
+ data.tar.gz: de76bc81d7667c5c5a349bc7aad0c3e25eb4bc9c4cd4cd93f46bbf751a7c1a5a468574d82d87d04726df0752230c7c1bf7390d966f1841ec684556ea0b2d004d
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.4
1
+ 3.2.6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.1.0] - 2025-08-25
4
+
5
+ - Migrate to Codeberg
6
+
3
7
  ## [1.0.0] - 2024-06-30
4
8
 
5
9
  - Initial release
data/README.md CHANGED
@@ -43,7 +43,7 @@ class GetToThePoint
43
43
  end
44
44
  ```
45
45
 
46
- The import syntax is an array because you can import multiple packages. The imported packages will "compose" together, meaning the methods from the various package modules will all be available simultaneously.
46
+ The import syntax is an array because you can import multiple packages. The imported packages will "compose" together, meaning the methods from the various package modules will all be available simultaneously. (Under the hood, a new anonymous module is created with mixins of the modules you are importing as the packages.)
47
47
 
48
48
  In addition to creating instance methods using the `packages` class helper, you can use the `packages` method inline:
49
49
 
@@ -58,9 +58,28 @@ end
58
58
  This approach isn't recommended unless you're in a context where using the class helper is impossible, such as a template (ERB, etc.) or a block which is executed by a framework. You can also call the `packages` method directly on the `Inclusive` module:
59
59
 
60
60
  ```ruby
61
- my_math = Inclusive.packages(MyOrg::Math)
61
+ my_math = Inclusive.packages[MyOrg::Math]
62
62
  ```
63
63
 
64
+ Class-level methods can also be created using `packages` on the "class instance" (aka singleton class) which is also helpful for other modules:
65
+
66
+ ```ruby
67
+ module MyModule
68
+ class << self
69
+ extend Inclusive::Class
70
+
71
+ packages def utils = [
72
+ Packages::ThingOne,
73
+ Packages::ThingTwo,
74
+ ]
75
+ end
76
+ end
77
+
78
+ MyModule.utils.run # a method from one of the imported packages
79
+ ```
80
+
81
+ ### Public Package Methods
82
+
64
83
  If you want to be able to call a package method directly on its own module, you can extend your module and use the `public_function` helper:
65
84
 
66
85
  ```ruby
@@ -85,37 +104,15 @@ Packages::MyPackage.some_method
85
104
 
86
105
  This is only recommended if you need to mantain an existing module's legacy behavior in a codebase while incrementally adopting Inclusive.
87
106
 
88
- ### Packages Are Duplicated
107
+ ## but y tho 🤔
89
108
 
90
- One of the aspects of Inclusive which make it more useful than merely using standard Ruby modules is each imported package is actually a cloned module. This means a module can actually contain internal state, much like an object:
109
+ Why is this gem even needed? Well, any significantly-large project (and certainly the [Bridgetown framework](https://www.bridgetownrb.com) which gave rise to this effort) will have a "pile o' functions" which are loosely-related at best. Sometimes they're all crammed into a giant utility module or two, other times they're broken out into a handful of classes or whatever…even if they don't really need to be classes in the traditional object-oriented sense. Many other languages don't seem to have an issue with just writing utility functions and explicitly importing them in places where they're needed, but that hasn't been The Ruby Way.
91
110
 
92
- ```ruby
93
- module Packages
94
- module Ownership
95
- attr_accessor :owner
111
+ Until now. 😄
96
112
 
97
- def owner_classname
98
- owner.class.name
99
- end
100
- end
101
- end
102
-
103
- class SomeObject
104
- def try_out_ownership
105
- ownership = packages[Package::Ownership].tap { _1.owner = self }
106
-
107
- puts ownership.owner_classname # this will be `SomeObject`
108
- end
109
- end
113
+ Maybe Inclusive isn't for you, but for what we need, it gets the job done. Give it a try!
110
114
 
111
- class SomeOtherObject
112
- def try_out_ownership
113
- ownership = packages[Package::Ownership].tap { _1.owner = self }
114
-
115
- puts ownership.owner_classname # this will be `SomeOtherObject`
116
- end
117
- end
118
- ```
115
+ ----
119
116
 
120
117
  ## Development
121
118
 
@@ -125,12 +122,8 @@ To install this gem onto your local machine, run `bin/rake install`. To release
125
122
 
126
123
  ## Contributing
127
124
 
128
- Bug reports and pull requests are welcome on GitHub at https://github.com/bridgetownrb/inclusive. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/bridgetownrb/inclusive/blob/main/CODE_OF_CONDUCT.md).
125
+ Bug reports and pull requests are welcome on GitHub at https://codeberg.org/jaredwhite/inclusive. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://codeberg.org/jaredwhite/inclusive/src/branch/main/CODE_OF_CONDUCT.md).
129
126
 
130
127
  ## License
131
128
 
132
129
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
133
-
134
- ## Code of Conduct
135
-
136
- Everyone interacting in the Inclusive project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/bridgetownrb/inclusive/blob/main/CODE_OF_CONDUCT.md).
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Inclusive
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inclusive
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-30 00:00:00.000000000 Z
11
+ date: 2025-08-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: maintainers@bridgetownrb.com
@@ -25,12 +25,12 @@ files:
25
25
  - Rakefile
26
26
  - lib/inclusive.rb
27
27
  - lib/inclusive/version.rb
28
- homepage: https://github.com/bridgetownrb/inclusive
28
+ homepage: https://codeberg.org/jaredwhite/inclusive
29
29
  licenses:
30
30
  - MIT
31
31
  metadata:
32
- homepage_uri: https://github.com/bridgetownrb/inclusive
33
- source_code_uri: https://github.com/bridgetownrb/inclusive
32
+ homepage_uri: https://codeberg.org/jaredwhite/inclusive
33
+ source_code_uri: https://codeberg.org/jaredwhite/inclusive
34
34
  rubygems_mfa_required: 'true'
35
35
  post_install_message:
36
36
  rdoc_options: []
@@ -47,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  requirements: []
50
- rubygems_version: 3.3.26
50
+ rubygems_version: 3.4.19
51
51
  signing_key:
52
52
  specification_version: 4
53
53
  summary: Compose globally-scoped Ruby modules into local packages