y_support 2.0.24 → 2.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/y_support/core_ext/object/misc.rb +5 -4
- data/lib/y_support/version.rb +1 -1
- data/test/misc_test.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0561e18c5b606a92e92f8ebfe01b3e350ad8feab
|
4
|
+
data.tar.gz: 05822896871dba52532fb86bb1260c294c834076
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6accb0f8a63e501963efbe7abeb5eca5c5674e9138e84e8e28c98ec12959680595d40763da3a3ec69a62a8e74422969a42ff2f03811d3ea871192cee87bb225b
|
7
|
+
data.tar.gz: 5aaefcb56b0efa60fd847d28649c8b893d6af7919fdf7dc98e51957d534f5b7c560c7d1f7bef61de5d2b9bb00239bb65856a61335795b88573f82e5e53633e45
|
@@ -14,11 +14,12 @@ class Object
|
|
14
14
|
}
|
15
15
|
end
|
16
16
|
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
17
|
+
# Makes the receiver own parametrized subclasses of the supplied classes.
|
18
|
+
# Expects a hash of pairs { reader_symbol: class }, and a hash of parameters,
|
19
|
+
# with which the class(es) is (are) parametrized. Parametrized subclasses
|
20
|
+
# are made accessible under the supplied reader symbol.
|
20
21
|
#
|
21
|
-
def
|
22
|
+
def param_class hash, with: (fail ArgumentError, "No parameters!")
|
22
23
|
hash.each { |ß, ç| set_attr_with_readers ß => ç.parametrize( **with ) }
|
23
24
|
return nil
|
24
25
|
end
|
data/lib/y_support/version.rb
CHANGED
data/test/misc_test.rb
CHANGED
@@ -9,9 +9,9 @@ describe Object do
|
|
9
9
|
require 'y_support/core_ext/object'
|
10
10
|
end
|
11
11
|
|
12
|
-
it "should have #
|
12
|
+
it "should have #param_class" do
|
13
13
|
o = Object.new
|
14
|
-
o.
|
14
|
+
o.param_class( { Array: Array, foo: Hash }, with: { mother: o } )
|
15
15
|
assert o.Array < Array
|
16
16
|
o.Array.mother.must_equal( o )
|
17
17
|
o.foo.mother.must_equal( o )
|