universe_compiler 0.4.1 → 0.4.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d09b8d02e98418aef483a480fb61437a50598419
|
4
|
+
data.tar.gz: 64ce9d0d55cd3d993f41dfbf38035506e259fe7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dce3601fef115bc74a0b395a90a9e7946c667b5a7a09afb77ed8246bf9381111ebe31c8256375ec9a159dff1ef4c28f7342dc3a1b26dd12c23b1ab40d3bcac64
|
7
|
+
data.tar.gz: f25e06b4e0236c55b19c801b65331049e27a5a946f1eecaac60a9603b49426cf83b9abc58e28ffb57ee06f69bf4647ca15c88498ecd352fd1c36fa57390a0668
|
@@ -13,9 +13,8 @@ module UniverseCompiler
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def define_reverse_method(
|
16
|
+
def define_reverse_method(method_name, method_definition_constraints)
|
17
17
|
metaclass = class << self; self ; end
|
18
|
-
method_name = normalize_method_name(default_method_name, method_definition_constraints)
|
19
18
|
UniverseCompiler.logger.debug 'Defining reverse method "%s" on class %s (%s)' % [method_name, metaclass, self.type]
|
20
19
|
raise UniverseCompiler::Error, "'#{method_name}' already exists on class '#{metaclass}'. Skipped !" if self.respond_to? method_name
|
21
20
|
method_definition_constraints[:actual_method] = method_name
|
@@ -54,16 +53,6 @@ module UniverseCompiler
|
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
57
|
-
|
58
|
-
|
59
|
-
def normalize_method_name(default_method_name, method_definition_constraints)
|
60
|
-
if default_method_name == method_definition_constraints[:source_entity]
|
61
|
-
"referenced_from_#{method_definition_constraints[:source_entity]}_entities"
|
62
|
-
else
|
63
|
-
default_method_name
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
56
|
def define_known_fields_accessors
|
68
57
|
self.class.fields_constraints.each do |field_name, constraints|
|
69
58
|
next if constraints[:reverse_method]
|
@@ -46,7 +46,7 @@ module UniverseCompiler
|
|
46
46
|
def define_constraint_for_reverse_method(relation_type, target_entity_type, source_field_name, with_reverse_method, unique)
|
47
47
|
reverse_method_name = case with_reverse_method
|
48
48
|
when TrueClass
|
49
|
-
self.entity_type
|
49
|
+
"referenced_from_#{self.entity_type}_#{source_field_name}".to_sym
|
50
50
|
when String, Symbol
|
51
51
|
with_reverse_method.to_sym
|
52
52
|
end
|