Class: Arrow::Template::URLEncodeDirective
- Inherits:
 - 
      CallDirective
      
        
- Object
 - Arrow::Object
 - Node
 - Directive
 - AttributeDirective
 - CallDirective
 - Arrow::Template::URLEncodeDirective
 
 - Defined in:
 - lib/arrow/template/urlencode.rb
 
Overview
The Arrow::Template::URLEncodeDirective class, a derivative of Arrow::Template::CallDirective. This is the class which defines the behaviour of the ‘urlencode’ template directive.
VCS Id
$Id$
Authors
Michael Granger
Please see the file LICENSE in the top-level directory for licensing details.
Constant Summary
- NonUricRegexp =
          
Non-URIC Characters (RFC 2396)
 /[^A-Za-z0-9\-_.!~*'()]/
Constants inherited from CallDirective
Constants inherited from AttributeDirective
Constants inherited from Directive
Constants inherited from Node
Constants included from Arrow::HTMLUtilities
ARRAY_HTML_CONTAINER, HASH_HTML_CONTAINER, HASH_PAIR_HTML, IMMEDIATE_OBJECT_HTML_CONTAINER, IVAR_HTML_FRAGMENT, OBJECT_HTML_CONTAINER, THREAD_DUMP_KEY
Instance Method Summary
- 
  
    
      - (Object) render(template, scope) 
    
    
  
  
  
  
  
  
  
    
Render the content and return it as URL-escaped text.
 
Methods inherited from AttributeDirective
allows_format?, #before_rendering, #build_rendering_proc, #call_methodchain, #initialize, #inspect, #is_rendering_node?, #parse_directive_contents, #render_contents, #to_html
Methods inherited from Directive
create, derivativeDirs, #initialize, #inspect, #parse_directive_contents, #to_html
Methods inherited from Node
#add_to_template, #css_class, #initialize, #inspect, #is_rendering_node?, #to_a, #to_html, #to_s
Methods included from Arrow::HTMLUtilities
#escape_html, #make_html_for_object, #make_object_html_wrapper
Methods inherited from Arrow::Object
deprecate_class_method, deprecate_method, inherited
Methods included from Arrow::Loggable
Constructor Details
This class inherits a constructor from Arrow::Template::AttributeDirective
Instance Method Details
- (Object) render(template, scope)
Render the content and return it as URL-escaped text.
      33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  | 
    
      # File 'lib/arrow/template/urlencode.rb', line 33 def render( template, scope ) rawary = super rary = [] # Try our best to skip debugging comments if template._config[:debuggingComments] rary.push( rawary.shift ) if /^<!--.*-->$/ =~ rawary.first end rawary.each do |line| rary << line.to_s.gsub( NonUricRegexp ) do |match| "%%%02x" % [ match[0] ] end end return rary end  |