template_class 1.2.0 → 1.2.2

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: e4c0985a84c4d73b07449fea319cd108c0a78477fa0975a0a946dcb82d05dbda
4
- data.tar.gz: 35cc326a7341985c9d3a416fcad8b58a9465f4e72a083d7c4e9d153ed4f312d4
3
+ metadata.gz: 735dddf04d44a0c4c68d440b9bd03cce3492a2fc1cd9a3ebad7c5c45693ab105
4
+ data.tar.gz: 769971cbd1122fbc11ac80e587bef01d76fc1a4c24708747d9978f5956fc609a
5
5
  SHA512:
6
- metadata.gz: 1cc67fea8a072fd2fcf64a7bb7b17d22ae801b1547dd92cccd27a0e6f4c939870b032112bf845dc0974d8860d797f4e12c104f19437be369de70e8d0009ff21a
7
- data.tar.gz: f756b227610d4503557b949dde1ed5f908fac9da1f3353a7dd55a7772f84e145eb419a1fad568f0a497d08d772a29a340b20fc839910ceee92baeedda9cc8065
6
+ metadata.gz: b317516970986d38dc1e8f637ea481c861a6e9d54f0de880fddcac129a74b857431177dcbdd7df10ec52861e13e9450e911bfde2ab06a58fe55063b79d898451
7
+ data.tar.gz: 4f387baf8ab79ff206af4222df6cdb481af980a1283e6cc76343bb35fd5cc65f2a47a37786ae3a144acd609fc219de95ace09d29b4dd2e8415b17d4581309861
data/CHANGELOG.md CHANGED
@@ -8,6 +8,18 @@
8
8
  ### Bug fixes
9
9
  )-->
10
10
 
11
+ ## 1.2.2 2025-01-29
12
+
13
+ ### Bug fixes
14
+
15
+ - Fixed overrides for bulk instantiation not being picked up in Rails >= 7.1.
16
+
17
+ ## 1.2.1 2025-01-20
18
+
19
+ ### Bug fixes
20
+
21
+ - Relaxed dependency.
22
+
11
23
  ## 1.2.0 2024-08-19
12
24
 
13
25
  ### New features
@@ -10,8 +10,15 @@ module TemplateClass
10
10
  into.const_set constant.name.demodulize.to_sym, constant[*args]
11
11
  end
12
12
  .tap { return unless with_overrides } # rubocop:disable Lint/NonLocalExitFromIterator
13
- .each do |instance|
14
- require instance.name.underscore
13
+ .map do |instance|
14
+ Object
15
+ .const_source_location(instance.module_parent_name)
16
+ .first
17
+ .delete_suffix('.rb')
18
+ .then { "#{_1}/#{instance.name.demodulize.underscore}" }
19
+ end
20
+ .each do |path|
21
+ require path
15
22
  rescue LoadError
16
23
  nil
17
24
  end
@@ -1,7 +1,3 @@
1
- require 'active_support/concern'
2
- require 'active_support/core_ext/module/delegation'
3
- require 'active_support/core_ext/module/attribute_accessors'
4
-
5
1
  module TemplateClass
6
2
  module Template
7
3
  extend ActiveSupport::Concern
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TemplateClass
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.2'
5
5
  end
@@ -1,3 +1,10 @@
1
1
  require_relative 'template_class/version'
2
+
3
+ require 'active_support/concern'
4
+ require 'active_support/core_ext/string/inflections'
5
+ require 'active_support/core_ext/module/delegation'
6
+ require 'active_support/core_ext/module/attribute_accessors'
7
+ require 'active_support/core_ext/module/introspection'
8
+
2
9
  require_relative 'template_class/template'
3
10
  require_relative 'template_class/bulk_instantiable'
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/template_class/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'template_class'
7
+ spec.version = TemplateClass::VERSION
8
+ spec.authors = ['Moku S.r.l.', 'Riccardo Agatea']
9
+ spec.email = ['info@moku.io']
10
+ spec.license = 'MIT'
11
+
12
+ spec.summary = 'A way to define templated classes, in a similar fashion to C++ templates.'
13
+ spec.description = 'In most cases Ruby doesn\'t need templated classes, nor any other system of generics, because it isn\'t statically type checked. However, sometimes we need to automatically generate multiple similar classes, either because of poor design or because of external necessities. For example, to define a GraphQL schema with GraphQL Ruby (https://graphql-ruby.org/) we need to define a distinct class for each type. Since GraphQL is statically type checked but doesn\'t provide generics, if we need a set of similar but distinct types we\'re left to define them one by one.'
14
+ spec.homepage = 'https://github.com/moku-io/template_class'
15
+ spec.required_ruby_version = '>= 3.0.0' # Maybe we should check (?)
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://github.com/moku-io/template_class'
19
+ spec.metadata['changelog_uri'] = 'https://github.com/moku-io/template_class'
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir __dir__ do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
26
+ end
27
+ end
28
+ spec.bindir = 'exe'
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ['lib']
31
+
32
+ spec.add_dependency 'activesupport'
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: template_class
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moku S.r.l.
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-08-19 00:00:00.000000000 Z
12
+ date: 2025-01-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 7.0.0
20
+ version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 7.0.0
27
+ version: '0'
28
28
  description: In most cases Ruby doesn't need templated classes, nor any other system
29
29
  of generics, because it isn't statically type checked. However, sometimes we need
30
30
  to automatically generate multiple similar classes, either because of poor design
@@ -51,6 +51,7 @@ files:
51
51
  - lib/template_class/template.rb
52
52
  - lib/template_class/version.rb
53
53
  - sig/lib/template_class/template.rbs
54
+ - template_class.gemspec
54
55
  homepage: https://github.com/moku-io/template_class
55
56
  licenses:
56
57
  - MIT
@@ -73,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
74
  - !ruby/object:Gem::Version
74
75
  version: '0'
75
76
  requirements: []
76
- rubygems_version: 3.5.11
77
+ rubygems_version: 3.5.22
77
78
  signing_key:
78
79
  specification_version: 4
79
80
  summary: A way to define templated classes, in a similar fashion to C++ templates.