Class: ActiveadminCms::ComposerService
- Inherits:
-
Cyrax::Base
- Object
- Cyrax::Base
- ActiveadminCms::ComposerService
- Defined in:
- app/services/activeadmin_cms/composer_service.rb
Class Method Summary collapse
Instance Method Summary collapse
- #assign(option, value) ⇒ Object
-
#initialize(html = nil) ⇒ ComposerService
constructor
A new instance of ComposerService.
- #process_with(processor) ⇒ Object (also: #process)
- #render(&block) ⇒ Object
- #render! ⇒ Object
Constructor Details
#initialize(html = nil) ⇒ ComposerService
Returns a new instance of ComposerService.
9 10 11 12 13 |
# File 'app/services/activeadmin_cms/composer_service.rb', line 9 def initialize(html = nil) @html = html @options = {} @processors = [] end |
Class Method Details
.render(html, &block) ⇒ Object
4 5 6 |
# File 'app/services/activeadmin_cms/composer_service.rb', line 4 def render(html, &block) self.new(html).render(&block) end |
Instance Method Details
#assign(option, value) ⇒ Object
32 33 34 |
# File 'app/services/activeadmin_cms/composer_service.rb', line 32 def assign(option, value) @options[option.to_sym] = value end |
#process_with(processor) ⇒ Object Also known as: process
27 28 29 |
# File 'app/services/activeadmin_cms/composer_service.rb', line 27 def process_with(processor) @processors << processor end |
#render(&block) ⇒ Object
15 16 17 18 |
# File 'app/services/activeadmin_cms/composer_service.rb', line 15 def render(&block) block.call(self) if block_given? render! end |
#render! ⇒ Object
20 21 22 23 24 25 |
# File 'app/services/activeadmin_cms/composer_service.rb', line 20 def render! processor_classes.each do |processor_class| @html = processor_class.new(@html, @options).process! end @html end |