template_class 1.2.2 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +1 -1
- data/lib/template_class/template.rb +5 -2
- data/lib/template_class/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04740d36a74ebb180403184fef5051bd82e84fb3d1a541b6dce8975085978488
|
4
|
+
data.tar.gz: 1f6ddba16c05a876d6f7b5f9a49ffc30c99f7b1058b6d3a2642011ddad0f5fd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8db3d00ddbbb8e36a86620a9dd52a02668b4add6e123261dd07378aed837afb8ad7548f22c2ffee8c89cbec514de86d0dcdaf4bfbc4fe1058fb3e578e76229cd
|
7
|
+
data.tar.gz: 5fdc220273cc821b670c32531e45a97a5c35623721f63f93053fd6dcce0469ae47683fd192481add55edde420e1d6ea6d40e5f513ff605cfe58a81d75129de52
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,18 @@
|
|
8
8
|
### Bug fixes
|
9
9
|
)-->
|
10
10
|
|
11
|
+
## 1.3.1 2025-02-21
|
12
|
+
|
13
|
+
### Bug fixes
|
14
|
+
|
15
|
+
- Make the overrides of `to_s` and `inspect` of specializations return the name of the class in case it has one. Before, they would return the C++ style name even if the class/module had its own name.
|
16
|
+
|
17
|
+
## 1.3.0 2025-02-17
|
18
|
+
|
19
|
+
### New features
|
20
|
+
|
21
|
+
- Allow for template classes to create instances with `new`.
|
22
|
+
|
11
23
|
## 1.2.2 2025-01-29
|
12
24
|
|
13
25
|
### Bug fixes
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ gem install template_class
|
|
26
26
|
|
27
27
|
## Usage
|
28
28
|
|
29
|
-
Include `TemplateClass::Template` in the class or module you want to make into a template. You can
|
29
|
+
Include `TemplateClass::Template` in the class or module you want to make into a template. You can still make instances of a template, but you are expected to *specialize* it to some parameter. By default, any new specialization is an empty class. To define how a specialization is defined from a parameter, call `resolve_template_specialization`. The block you pass will be yielded the parameter that's specializing the template and a class constructor that makes it possible to recursively use the new specialization.
|
30
30
|
|
31
31
|
```ruby
|
32
32
|
class List
|
@@ -12,7 +12,6 @@ module TemplateClass
|
|
12
12
|
instance_accessor: false
|
13
13
|
|
14
14
|
singleton_class.delegate :[], :[]=, to: :cache
|
15
|
-
singleton_class.undef_method :new
|
16
15
|
end
|
17
16
|
|
18
17
|
class CacheClassConstructor
|
@@ -33,7 +32,11 @@ module TemplateClass
|
|
33
32
|
outer_self = self
|
34
33
|
|
35
34
|
klass.define_singleton_method :to_s do
|
36
|
-
|
35
|
+
if respond_to?(:anonymous?) ? anonymous? : name.nil?
|
36
|
+
"#{outer_self.owner}<#{outer_self.key}>"
|
37
|
+
else
|
38
|
+
super()
|
39
|
+
end
|
37
40
|
end
|
38
41
|
|
39
42
|
klass.singleton_class.alias_method :inspect, :to_s
|
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.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moku S.r.l.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-
|
12
|
+
date: 2025-02-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|