Class: Saruman::ModelXmlConfigBuilder
Instance Method Summary
collapse
#method_missing
Constructor Details
Returns a new instance of ModelXmlConfigBuilder.
512
513
514
515
516
517
518
519
|
# File 'lib/saruman.rb', line 512
def initialize(models, generator)
@models = models
@generator = generator
@config_models_resource_entities_xml = set_config_models_resource_entities_xml
@config_models_resource_xml = set_config_models_resource_xml
@config_global_models_model_xml = set_config_global_models_model_xml
@config_global_resources_xml = set_config_global_resources_xml
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Saruman::XmlBuilderBase
Instance Method Details
#set_config_global_models_model_xml ⇒ Object
541
542
543
544
545
546
547
548
549
|
# File 'lib/saruman.rb', line 541
def set_config_global_models_model_xml
xml = "
<#{extension_name_lower}>
<class>#{model_klass_name}</class>
<resourceModel>#{resource_model_name}</resourceModel>
</#{extension_name_lower}>
"
return xml
end
|
#set_config_global_resources_xml ⇒ Object
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
|
# File 'lib/saruman.rb', line 551
def set_config_global_resources_xml
xml = "
<resources>
<#{extension_name_lower}_setup>
<setup>
<module>#{combined_namespace}</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</#{extension_name_lower}_setup>
<#{extension_name_lower}_write>
<connection>
<use>core_write</use>
</connection>
</#{extension_name_lower}_write>
<#{extension_name_lower}_read>
<connection>
<use>core_read</use>
</connection>
</#{extension_name_lower}_read>
</resources>
"
return xml
end
|
#set_config_models_resource_entities_xml ⇒ Object
521
522
523
524
525
526
527
|
# File 'lib/saruman.rb', line 521
def set_config_models_resource_entities_xml
xml = ""
models.each do |model|
xml << "<#{model.name_lower}><table>#{model.table_name}</table></#{model.name_lower}>\n"
end
return xml
end
|
#set_config_models_resource_xml ⇒ Object
529
530
531
532
533
534
535
536
537
538
539
|
# File 'lib/saruman.rb', line 529
def set_config_models_resource_xml
xml = "
<#{resource_model_name}>
<class>#{resource_model_klass_name}</class>
<entities>
#{config_models_resource_entities_xml}
</entities>
</#{resource_model_name}>
"
return xml
end
|