Module: WithTemplate::ViewAdditions
- Defined in:
- lib/with_template/view_additions.rb
Instance Method Summary collapse
- #global_template ⇒ Object
- #with_global_template(template, options = {}, &block) ⇒ Object
- #with_template(template, options = {}, &block) ⇒ Object
Instance Method Details
#global_template ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/with_template/view_additions.rb', line 21 def global_template if @global_template.blank? @global_template = WithTemplate::Base.new(self) @global_template.blocks = blocks.blocks @global_template.skipped_blocks = blocks.skipped_blocks @global_template.anonymous_block_number = blocks.anonymous_block_number end @global_template end |
#with_global_template(template, options = {}, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/with_template/view_additions.rb', line 9 def with_global_template(template, ={}, &block) = .with_indifferent_access variable = .delete(:variable) || :global_template if @global_template.present? @global_template..reverse_merge!() @global_template..merge!(@global_template.) else @global_template = WithTemplate::Base.new(self, ) end @global_template.render_template(template, variable, &block) end |
#with_template(template, options = {}, &block) ⇒ Object
3 4 5 6 7 |
# File 'lib/with_template/view_additions.rb', line 3 def with_template(template, ={}, &block) = .with_indifferent_access template_variable = .delete(:variable) || :template WithTemplate::Base.new(self, ).render_template(template, template_variable, &block) end |