lib/activefacts/generators/helpers/oo.rb in activefacts-generators-1.8.3 vs lib/activefacts/generators/helpers/oo.rb in activefacts-generators-1.9.0

- old
+ new

@@ -45,11 +45,11 @@ select{|role| role.fact_type.all_role.size <= 2 && !role.fact_type.is_a?(ActiveFacts::Metamodel::LinkFactType) }. sort_by{|role| - other_role = role.fact_type.all_role.select{|r2| r2 != role}[0] || role + other_role = role.fact_type.all_role.select{|r2| r2 != role}[0] || role other_role.preferred_role_name(o) + ':' + role.preferred_role_name(other_role.object_type) }.each{|role| role_dump(role) } end @@ -57,11 +57,11 @@ def role_dump(role) fact_type = role.fact_type if fact_type.all_role.size == 1 unary_dump(role, role.preferred_role_name) return - end + end return if role.fact_type.entity_type if fact_type.all_role.size != 2 # Shouldn't come here, except perhaps for an invalid model return # ternaries and higher are always objectified @@ -89,12 +89,12 @@ # Find role name: role_method = role.preferred_role_name other_role_method = one_to_one ? role_method : "all_"+role_method # puts "---"+role.role_name if role.role_name if other_role_name != other_player.oo_default_role_name and - role_method == role.object_type.oo_default_role_name - # debugger + role_method == role.object_type.oo_default_role_name + # debugger other_role_method += "_as_#{other_role_name}" end role_name = role_method role_name = nil if role_name == role.object_type.oo_default_role_name @@ -117,10 +117,10 @@ role.preferred_role_name(fact_type.entity_type) }.each{|role| role_name = role.preferred_role_name(fact_type.entity_type) one_to_one = role.is_unique as = role_name != role.object_type.oo_default_role_name ? "_as_#{role_name}" : "" -# debugger if as != '' +# debugger if as != '' raise "Fact #{fact_type.describe} type is not objectified" unless fact_type.entity_type other_role_method = (one_to_one ? "" : "all_") + fact_type.entity_type.oo_default_role_name + as binary_dump(role, role_name, role.object_type, true, one_to_one, nil, nil, other_role_method)