acts_as_hashable 1.2.0.pre.alpha → 1.2.0.pre.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -1
- data/lib/acts_as_hashable/type_factory.rb +7 -2
- data/lib/acts_as_hashable/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0dede2b7914dcb91cd030c65e5385220553d7cd523172e40c5390a644598cb5
|
4
|
+
data.tar.gz: 47a708a122c7c12d80fa9932b24c2d5cbe4ab8cab97264afb818c0a0781ac308
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1720b09fddd1101546b452bde063e5d7a516d5883ce75cd4a5bca09726cf6d97ad7e28a7ca1dee4966fa926ffddc7a293b1dc7bc5e19888b420525ea156e4037
|
7
|
+
data.tar.gz: 69d1012dddafed50c20503cb27049d4df950182587f7d911f658b0fb239e36f103a62d70a6a5d3a35bc2ed535c28ef8cd309726ec18dd98825d1e1d2fcd7e169
|
data/Rakefile
CHANGED
@@ -36,11 +36,16 @@ module ActsAsHashable
|
|
36
36
|
type = config[type_key].to_s.to_sym
|
37
37
|
object_class = registry[type]
|
38
38
|
|
39
|
-
raise ArgumentError, "cannot find
|
39
|
+
raise ArgumentError, "cannot find registration for: '#{type}'" unless object_class
|
40
40
|
|
41
41
|
config_without_type = config.reject { |k| k == type_key }
|
42
42
|
|
43
|
-
|
43
|
+
# We want to defer to the classes proper maker if it exists.
|
44
|
+
# Technically, this factory should only make classes that include Hashable, but just to be
|
45
|
+
# sure we do not break any existing compatibility, lets make it work for both.
|
46
|
+
method_name = object_class.respond_to?(:make) ? :make : :new
|
47
|
+
|
48
|
+
object_class.send(method_name, config_without_type)
|
44
49
|
end
|
45
50
|
end
|
46
51
|
end
|