Module: Web::TemplatePrinter
- Included in:
- CGI
- Defined in:
- lib/web/template.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#template_name ⇒ Object
readonly
Returns the value of attribute template_name.
-
#template_vars ⇒ Object
readonly
Returns the value of attribute template_vars.
Instance Method Summary collapse
-
#assert_template_not_used(expected, message = "") ⇒ Object
Check that a particluar template was not used.
-
#assert_template_used(expected, message = "") ⇒ Object
Check that a particluar template was used.
- #assert_vars_equals ⇒ Object
-
#assert_vars_includes(expected) ⇒ Object
Check that these values were included in the output.
-
#print_template(template, template_object = {}, query = {}) ⇒ Object
writes template to self.
-
#template_include_path ⇒ Object
this must be an instance variable so that one can append to the include path without carrying over to the next test.
Instance Attribute Details
#template_name ⇒ Object (readonly)
Returns the value of attribute template_name.
561 562 563 |
# File 'lib/web/template.rb', line 561 def template_name @template_name end |
#template_vars ⇒ Object (readonly)
Returns the value of attribute template_vars.
561 562 563 |
# File 'lib/web/template.rb', line 561 def template_vars @template_vars end |
Instance Method Details
#assert_template_not_used(expected, message = "") ⇒ Object
Check that a particluar template was not used
592 593 594 595 596 597 598 599 600 |
# File 'lib/web/template.rb', line 592 def assert_template_not_used expected, ="" _wrap_assertion { raise TemplateException.new("No template used") if @templates == nil if @templates.include? expected msg = "template:<#{expected}> not supposed to be used in:<#{@templates.inspect}>" flunk(msg) end } end |
#assert_template_used(expected, message = "") ⇒ Object
Check that a particluar template was used
581 582 583 584 585 586 587 588 589 |
# File 'lib/web/template.rb', line 581 def assert_template_used expected, ="" _wrap_assertion { raise TemplateException.new("No template used") if @templates == nil unless @templates.include? expected msg = "expected template:<#{expected}> but not one of:<#{@templates.inspect}>" flunk(msg) end } end |
#assert_vars_equals ⇒ Object
607 608 609 |
# File 'lib/web/template.rb', line 607 def assert_vars_equals raise Exception.new("Not yet implemented") end |
#assert_vars_includes(expected) ⇒ Object
Check that these values were included in the output
603 604 605 |
# File 'lib/web/template.rb', line 603 def assert_vars_includes expected assert_includes expected, @template_vars end |
#print_template(template, template_object = {}, query = {}) ⇒ Object
writes template to self. Added by require ‘narf/template’ template can be a filename or a template string
564 565 566 567 568 569 570 |
# File 'lib/web/template.rb', line 564 def print_template (template, template_object ={}, query={}) flush @template_vars = template_object templater = Narflates.new(template,query) templater.parse(self ,template_object) @templates = templater.templates end |
#template_include_path ⇒ Object
this must be an instance variable so that one can append to the include path without carrying over to the next test
575 576 577 578 |
# File 'lib/web/template.rb', line 575 def template_include_path @template_include_path ||= Web::Narflates.template_include_path #Web::Narflates.template_include_path end |