Class: Saruman::ObserverXmlConfigBuilder

Inherits:
Object
  • Object
show all
Includes:
XmlBuilderBase, Virtus
Defined in:
lib/saruman.rb

Instance Method Summary collapse

Methods included from XmlBuilderBase

#method_missing

Constructor Details

#initialize(observers, generator) ⇒ ObserverXmlConfigBuilder

Returns a new instance of ObserverXmlConfigBuilder.



585
586
587
588
589
# File 'lib/saruman.rb', line 585

def initialize(observers, generator)
  @observers = observers
  @generator = generator
  @config_frontend_events_observers_xml = set_config_frontend_events_observers_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_frontend_events_observers_xmlObject



591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
# File 'lib/saruman.rb', line 591

def set_config_frontend_events_observers_xml
  xml=""
  observers.each do |event|
  xml << "
  <#{event}>
    <observers>
      <#{combined_namespace}_Model_Observer>
        <type>singleton</type>
        <class>#{combined_namespace}_Model_Observer</class>
        <method>#{event}</method>
      </#{combined_namespace}_Model_Observer>
    </observers>
  </#{event}>
"
  end
  return xml
end