Class: Arrow::Template::PrettyPrintDirective
- Inherits:
-
CallDirective
- Object
- Object
- Node
- Directive
- AttributeDirective
- CallDirective
- Arrow::Template::PrettyPrintDirective
- Defined in:
- lib/arrow/template/prettyprint.rb
Overview
The Arrow::Template::PrettyPrintDirective class, a derivative of Arrow::Template::CallDirective. This is the class which defines the behaviour of the ‘prettyprint’ template directive, which prettyprints and HTML-escapes its associated attribute/s.
Syntax
<pre><?prettyprint object ?></pre>
Authors
-
Michael Granger <[email protected]>
Please see the file LICENSE in the top-level directory for licensing details.
Constant Summary collapse
- SVNRev =
SVN Revision
%q$Rev$
- SVNId =
SVN Id
%q$Id$
Constants included from HTMLUtilities
HTMLUtilities::ARRAY_HTML_CONTAINER, HTMLUtilities::HASH_HTML_CONTAINER, HTMLUtilities::HASH_PAIR_HTML, HTMLUtilities::IMMEDIATE_OBJECT_HTML_CONTAINER, HTMLUtilities::IVAR_HTML_FRAGMENT, HTMLUtilities::OBJECT_HTML_CONTAINER, HTMLUtilities::THREAD_DUMP_KEY
Instance Attribute Summary
Attributes inherited from AttributeDirective
Attributes inherited from Node
Instance Method Summary collapse
-
#render(template, scope) ⇒ Object
Render the content and return it as prettyprinted text.
Methods inherited from AttributeDirective
allows_format?, #before_rendering, #initialize, #inspect, #is_rendering_node?, #to_html
Methods inherited from Directive
create, derivativeDirs, #initialize, #inspect, #to_html
Methods inherited from Node
#add_to_template, #initialize, #inspect, #is_rendering_node?, #to_a, #to_html, #to_s
Methods included from HTMLUtilities
escape_html, make_html_for_object, make_object_html_wrapper
Methods inherited from Object
deprecate_class_method, deprecate_method, inherited
Constructor Details
This class inherits a constructor from Arrow::Template::AttributeDirective
Instance Method Details
#render(template, scope) ⇒ Object
Render the content and return it as prettyprinted text.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/arrow/template/prettyprint.rb', line 34 def render( template, scope ) rawary = super rary = [] rawary.each do |item| ppstring = '' PP.pp( item, ppstring ) rary << ppstring. gsub( /&/, '&' ). gsub( /</, '<' ). gsub( />/, '>' ) end return rary end |