<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Module: HWSStrings — Documentation by YARD 0.8.7.6 </title> <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" /> <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" /> <script type="text/javascript" charset="utf-8"> hasFrames = window.top.frames.main ? true : false; relpath = ''; framesUrl = "frames.html#!HWSStrings.html"; </script> <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script> <script type="text/javascript" charset="utf-8" src="js/app.js"></script> </head> <body> <div id="header"> <div id="menu"> <a href="_index.html">Index (H)</a> » <span class="title">HWSStrings</span> <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div> </div> <div id="search"> <a class="full_list_link" id="class_list_link" href="class_list.html"> Class List </a> <a class="full_list_link" id="method_list_link" href="method_list.html"> Method List </a> <a class="full_list_link" id="file_list_link" href="file_list.html"> File List </a> </div> <div class="clear"></div> </div> <iframe id="search_frame"></iframe> <div id="content"><h1>Module: HWSStrings </h1> <dl class="box"> <dt class="r1 last">Defined in:</dt> <dd class="r1 last">lib/hws_strings.rb</dd> </dl> <div class="clear"></div> <h2>Constant Summary</h2> <dl class="constants"> <dt id="DEFAULT_ILLEGAL_CHARS-constant" class="">DEFAULT_ILLEGAL_CHARS = <div class="docstring"> <div class="discussion"> <p>These constants are used as the default configuration for the component_encode and component_decode methods.</p> </div> </div> <div class="tags"> </div> </dt> <dd><pre class="code"><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>~</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span></pre></dd> <dt id="DEFAULT_ESCAPE-constant" class="">DEFAULT_ESCAPE = </dt> <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>~</span><span class='tstring_end'>'</span></span></pre></dd> </dl> <h2> Class Method Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small> </h2> <ul class="summary"> <li class="public "> <span class="summary_signature"> <a href="#component_decode-class_method" title="component_decode (class method)">+ (Object) <strong>component_decode</strong>(str, escape = DEFAULT_ESCAPE, illegal_characters = DEFAULT_ILLEGAL_CHARS, base = 16) </a> </span> <span class="summary_desc"><div class='inline'> <p>Decodes a string encoded with component_encode.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#component_encode-class_method" title="component_encode (class method)">+ (Object) <strong>component_encode</strong>(str, illegal_characters: DEFAULT_ILLEGAL_CHARS) </a> </span> <span class="summary_desc"><div class='inline'> <p>Encode the string to make it usable as a single path in a URL.</p> </div></span> </li> </ul> <div id="class_method_details" class="method_details_list"> <h2>Class Method Details</h2> <div class="method_details first"> <h3 class="signature first" id="component_decode-class_method"> + (<tt>Object</tt>) <strong>component_decode</strong>(str, escape = DEFAULT_ESCAPE, illegal_characters = DEFAULT_ILLEGAL_CHARS, base = 16) </h3><div class="docstring"> <div class="discussion"> <p>Decodes a string encoded with component_encode.</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 29 30 31 32 33 34 35 36</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/hws_strings.rb', line 29</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_component_decode'>component_decode</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='comma'>,</span> <span class='id identifier rubyid_escape'>escape</span> <span class='op'>=</span> <span class='const'>DEFAULT_ESCAPE</span><span class='comma'>,</span> <span class='id identifier rubyid_illegal_characters'>illegal_characters</span> <span class='op'>=</span> <span class='const'>DEFAULT_ILLEGAL_CHARS</span><span class='comma'>,</span> <span class='id identifier rubyid_base'>base</span><span class='op'>=</span><span class='int'>16</span><span class='rparen'>)</span> <span class='id identifier rubyid_escape_map'>escape_map</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_illegal_characters'>illegal_characters</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_c'>c</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_escape'>escape</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_ord'>ord</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='id identifier rubyid_base'>base</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='rbracket'>]</span> <span class='id identifier rubyid_escape_map'>escape_map</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_ch'>ch</span><span class='comma'>,</span> <span class='id identifier rubyid_escaped'>escaped</span><span class='op'>|</span> <span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='id identifier rubyid_escaped'>escaped</span><span class='comma'>,</span> <span class='id identifier rubyid_ch'>ch</span><span class='rparen'>)</span> <span class='kw'>end</span> <span class='id identifier rubyid_str'>str</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="component_encode-class_method"> + (<tt>Object</tt>) <strong>component_encode</strong>(str, illegal_characters: DEFAULT_ILLEGAL_CHARS) </h3><div class="docstring"> <div class="discussion"> <p>Encode the string to make it usable as a single path in a URL.</p> <p>This a simple scheme that should allow you to match the string in a single path variable easily, in a way that should not be messed with by your web framework.</p> <p>Many characters that are legal as file names by the Helix Versioning Engine can make URL handling difficult. The most basic is the forward slash '/'.</p> <p>This does <em>NOT</em> guarantee that the string is URL safe! You should still percent-encode any string as a URL.</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 18 19 20 21 22 23 24 25 26</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/hws_strings.rb', line 18</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_component_encode'>component_encode</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='comma'>,</span> <span class='label'>illegal_characters:</span> <span class='const'>DEFAULT_ILLEGAL_CHARS</span><span class='rparen'>)</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_chars'>chars</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_ch'>ch</span><span class='op'>|</span> <span class='kw'>if</span> <span class='id identifier rubyid_illegal_characters'>illegal_characters</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_ch'>ch</span><span class='rparen'>)</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>~</span><span class='tstring_end'>'</span></span> <span class='op'>+</span> <span class='id identifier rubyid_ch'>ch</span><span class='period'>.</span><span class='id identifier rubyid_ord'>ord</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='int'>16</span><span class='rparen'>)</span> <span class='kw'>else</span> <span class='id identifier rubyid_ch'>ch</span> <span class='kw'>end</span> <span class='kw'>end</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> Generated on Mon Oct 12 22:20:49 2015 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.8.7.6 (ruby-2.2.3). </div> </body> </html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#11 | 16275 | Doug Scheirer | Merge from main | ||
#10 | 16196 | Doug Scheirer | Merge from main | ||
#9 | 16148 | Doug Scheirer | Merge from main | ||
#8 | 16114 | Doug Scheirer | Merge from main | ||
#7 | 16079 | Doug Scheirer | Merge from main | ||
#6 | 16014 | Doug Scheirer | Merge down from main | ||
#5 | 15884 | Doug Scheirer | Merge from main | ||
#4 | 15868 | Doug Scheirer | Merge from main | ||
#3 | 15845 | Doug Scheirer | Integ from main | ||
#2 | 15715 | Doug Scheirer | merge changes from main | ||
#1 | 15688 | Doug Scheirer |
Populate -o //guest/perforce_software/helix-web-services/... //guest/doug_scheirer/helix-web-services/.... |
||
//guest/perforce_software/helix-web-services/main/build/doc/helix_web_services/HWSStrings.html | |||||
#3 | 15676 | tjuricek | HWS/NOARCH/2015.1.main/201509092205 | ||
#2 | 15589 | tjuricek | Update path to test output and update docs. | ||
#1 | 15542 | tjuricek |
Add spaces to our basic 'component encode' mechanism, and use it for HVE project IDs. In general, this will make the HVE IDs a bit more readable. |