modularity 3.0.1 → 3.2.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: f12124ad13bb239a891eb310290f11b78ec59afe6c8b06a5e93a31de25419a62
4
- data.tar.gz: 9b742d62111676d20497e9c847f8a31eca318b292768385b85236f4815eb4f46
3
+ metadata.gz: 3500f4c9d90a6b3b13f9a1a7aca62a5cc3ddcfc06865e26ccb7283ac9af29b97
4
+ data.tar.gz: b6dda8d76433413451f2fbafaa4b4fde63b16b5397942132cfb7b7a0eb1292d6
5
5
  SHA512:
6
- metadata.gz: ec89142e9de11baa4f818bd89f33c102cad9695ca03d9b53e4db5519dc0f8dd2a46ac1ed48383a8576e6039948a7a202ef6602aa0ffea5ea4c71c7b8fb3bc171
7
- data.tar.gz: 9888756a4e7f8a964127211a4d1237aa9abea0983ffadac3d1a45862d9d7e1e349a13178d447dbef22c4edd0cd0f84bb60dda9ebe5f089dd0ed6c30f99dd12a4
6
+ metadata.gz: 274f172610a0900ec8348a45488b8e54c061d5809942f16094f886e7e8e1ddf828635640568db36b0177d2b575c9f319ce75ba07bfb473b1a5e00180f3a6c0d0
7
+ data.tar.gz: 031fa42034a8453d3cd0e0742109c7a2652e4de41b1be4d04d891e20a74e822b2105257ebb6ec470e09eae12dd043cd51501faf05e97c1b44d2c435c287fc473
@@ -16,10 +16,16 @@ jobs:
16
16
  include:
17
17
  - ruby: 2.5.7
18
18
  gemfile: Gemfile
19
+ - ruby: 2.6.10
20
+ gemfile: Gemfile
19
21
  - ruby: 2.7.4
20
22
  gemfile: Gemfile
21
23
  - ruby: 3.0.2
22
24
  gemfile: Gemfile
25
+ - ruby: 3.1.2
26
+ gemfile: Gemfile
27
+ - ruby: 3.2.1
28
+ gemfile: Gemfile
23
29
  env:
24
30
  BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
25
31
  steps:
data/CHANGELOG.md CHANGED
@@ -9,6 +9,19 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
9
9
 
10
10
  ### Compatible changes
11
11
 
12
+ ## 3.2.0 - 2023-03-01
13
+
14
+ ### Compatible changes
15
+
16
+ - Add support for Ruby 3.2
17
+
18
+
19
+ ## 3.1.0 - 2022-06-01
20
+
21
+ ### Compatible changes
22
+
23
+ - Add support for separation of positional and keyword arguments in ruby 3
24
+
12
25
 
13
26
  ## 3.0.1 - 2022-03-09
14
27
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- modularity (3.0.1)
4
+ modularity (3.2.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -9,7 +9,7 @@ GEM
9
9
  byebug (11.1.3)
10
10
  coderay (1.1.3)
11
11
  diff-lcs (1.4.4)
12
- gemika (0.6.1)
12
+ gemika (0.8.1)
13
13
  method_source (1.0.0)
14
14
  pry (0.13.1)
15
15
  coderay (~> 1.1)
data/README.md CHANGED
@@ -13,7 +13,7 @@ in a way that is less awkward than using modules.
13
13
 
14
14
  Add the following to your `Gemfile`:
15
15
 
16
- ```
16
+ ```ruby
17
17
  gem 'modularity'
18
18
  ```
19
19
 
@@ -32,7 +32,7 @@ and macros.
32
32
 
33
33
  Here is an example of a `strip_field` macro, which created setter methods that remove leading and trailing whitespace from newly assigned values:
34
34
 
35
- ```
35
+ ```ruby
36
36
  # app/models/article.rb
37
37
  class Article < ActiveRecord::Base
38
38
  include DoesStripFields[:name, :brand]
@@ -61,7 +61,7 @@ Using a module to add both instance methods and class methods is
61
61
  [very awkward](http://redcorundum.blogspot.com/2006/06/mixing-in-class-methods.html).
62
62
  Modularity does away with the clutter and lets you say this:
63
63
 
64
- ```
64
+ ```ruby
65
65
  # app/models/model.rb
66
66
  class Model
67
67
  include Mixin
@@ -88,7 +88,7 @@ Models are often concerned with multiple themes like "authentication", "contact
88
88
  a couple of validations and callbacks here, and some method there. Modularity lets you organize your model into multiple
89
89
  partial classes, so each file can deal with a single aspect of your model:
90
90
 
91
- ```
91
+ ```ruby
92
92
  # app/models/user.rb
93
93
  class User < ActiveRecord::Base
94
94
  include DoesAuthentication
@@ -2,14 +2,19 @@ module Modularity
2
2
 
3
3
  class ParametrizedTrait < Module
4
4
 
5
- def initialize(blank_trait, args)
5
+ def initialize(blank_trait, args, kwargs)
6
6
  @args = args
7
+ @kwargs = kwargs
7
8
  @macro = blank_trait.instance_variable_get(:@modularity_macro)
8
9
  include(blank_trait)
9
10
  end
10
11
 
11
12
  def included(base)
12
- base.class_exec(*@args, &@macro)
13
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7')
14
+ base.class_exec(*@args, &@macro)
15
+ else
16
+ base.class_exec(*@args, **@kwargs, &@macro)
17
+ end
13
18
  end
14
19
 
15
20
  end
@@ -27,9 +32,16 @@ module Modularity
27
32
 
28
33
  end
29
34
 
30
- def self.[](*args)
31
- blank_trait = self
32
- ParametrizedTrait.new(blank_trait, args)
35
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7')
36
+ def self.[](*args)
37
+ blank_trait = self
38
+ ParametrizedTrait.new(blank_trait, args, {})
39
+ end
40
+ else
41
+ def self.[](*args, **kwargs)
42
+ blank_trait = self
43
+ ParametrizedTrait.new(blank_trait, args, kwargs)
44
+ end
33
45
  end
34
46
 
35
47
  end
@@ -1,3 +1,3 @@
1
1
  module Modularity
2
- VERSION = '3.0.1'
2
+ VERSION = '3.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modularity
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-09 00:00:00.000000000 Z
11
+ date: 2023-03-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Traits and partial classes for Ruby
14
14
  email: