<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title> Module: Doing::StringTransform — Documentation by YARD 0.9.28 </title> <link rel="stylesheet" href="../css/style.css" type="text/css" /> <link rel="stylesheet" href="../css/common.css" type="text/css" /> <script type="text/javascript"> pathId = "Doing::StringTransform"; relpath = '../'; </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 class="nav_wrap"> <iframe id="nav" src="../class_list.html?1"></iframe> <div id="resizer"></div> </div> <div id="main" tabindex="-1"> <div id="header"> <div id="menu"> <a href="../_index.html">Index (S)</a> » <span class='title'><span class='object_link'><a href="../Doing.html" title="Doing (module)">Doing</a></span></span> » <span class="title">StringTransform</span> </div> <div id="search"> <a class="full_list_link" id="class_list_link" href="../class_list.html"> <svg width="24" height="24"> <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect> <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect> <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect> </svg> </a> </div> <div class="clear"></div> </div> <div id="content"><h1>Module: Doing::StringTransform </h1> <div class="box_info"> <dl> <dt>Included in:</dt> <dd><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></dd> </dl> <dl> <dt>Defined in:</dt> <dd>lib/doing/string/transform.rb</dd> </dl> </div> <h2>Overview</h2><div class="docstring"> <div class="discussion"> <p>String helpers</p> </div> </div> <div class="tags"> </div> <h2> Instance Method Summary <small><a href="#" class="summary_toggle">collapse</a></small> </h2> <ul class="summary"> <li class="public "> <span class="summary_signature"> <a href="#cap_first-instance_method" title="#cap_first (instance method)">#<strong>cap_first</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'><p>Capitalize on the first character on string.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#compress-instance_method" title="#compress (instance method)">#<strong>compress</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'><p>Compress multiple spaces to single space.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#compress!-instance_method" title="#compress! (instance method)">#<strong>compress!</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'></div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#set_type-instance_method" title="#set_type (instance method)">#<strong>set_type</strong>(kind = nil) ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'><p>Convert a string value to an appropriate type.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#simple_wrap-instance_method" title="#simple_wrap (instance method)">#<strong>simple_wrap</strong>(width) ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'></div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#titlecase-instance_method" title="#titlecase (instance method)">#<strong>titlecase</strong> ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'></div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#to_p-instance_method" title="#to_p (instance method)">#<strong>to_p</strong>(number) ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'><p>Pluralize a string based on quantity.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#wrap-instance_method" title="#wrap (instance method)">#<strong>wrap</strong>(len, pad: 0, indent: ' ', offset: 0, prefix: '', color: '', after: '', reset: '', pad_first: false) ⇒ Object </a> </span> <span class="summary_desc"><div class='inline'><p>Wrap string at word breaks, respecting tags.</p> </div></span> </li> </ul> <div id="instance_method_details" class="method_details_list"> <h2>Instance Method Details</h2> <div class="method_details first"> <h3 class="signature first" id="cap_first-instance_method"> #<strong>cap_first</strong> ⇒ <tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt> </h3><div class="docstring"> <div class="discussion"> <p>Capitalize on the first character on string</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'></span> <div class='inline'><p>Capitalized string</p> </div> </li> </ul> </div> </div> <div class="method_details "> <h3 class="signature " id="compress-instance_method"> #<strong>compress</strong> ⇒ <tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt> </h3><div class="docstring"> <div class="discussion"> <p>Compress multiple spaces to single space</p> </div> </div> <div class="tags"> </div> </div> <div class="method_details "> <h3 class="signature " id="compress!-instance_method"> #<strong>compress!</strong> ⇒ <tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt> </h3> </div> <div class="method_details "> <h3 class="signature " id="set_type-instance_method"> #<strong>set_type</strong>(kind = nil) ⇒ <tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt> </h3><div class="docstring"> <div class="discussion"> <p>Convert a string value to an appropriate type. If kind is not specified, '[one, two]' becomes an Array, '1' becomes Integer, '1.5' becomes Float, 'true' or 'yes' becomes TrueClass, 'false' or 'no' becomes FalseClass.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>kind</span> <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span> <em class="default">(defaults to: <tt>nil</tt>)</em> — <div class='inline'><p>specify string, array, integer, float, symbol, or boolean (falls back to string if value is not recognized)</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'></span> <div class='inline'><p>Converted object type</p> </div> </li> </ul> </div> </div> <div class="method_details "> <h3 class="signature " id="simple_wrap-instance_method"> #<strong>simple_wrap</strong>(width) ⇒ <tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt> </h3> </div> <div class="method_details "> <h3 class="signature " id="titlecase-instance_method"> #<strong>titlecase</strong> ⇒ <tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt> </h3> </div> <div class="method_details "> <h3 class="signature " id="to_p-instance_method"> #<strong>to_p</strong>(number) ⇒ <tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt> </h3><div class="docstring"> <div class="discussion"> <p>Pluralize a string based on quantity</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>number</span> <span class='type'>(<tt>Integer</tt>)</span> — <div class='inline'><p>the quantity of the object the string represents</p> </div> </li> </ul> </div> </div> <div class="method_details "> <h3 class="signature " id="wrap-instance_method"> #<strong>wrap</strong>(len, pad: 0, indent: ' ', offset: 0, prefix: '', color: '', after: '', reset: '', pad_first: false) ⇒ <tt><span class='object_link'><a href="../Object.html" title="Object (class)">Object</a></span></tt> </h3><div class="docstring"> <div class="discussion"> <p>Wrap string at word breaks, respecting tags</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>len</span> <span class='type'>(<tt>Integer</tt>)</span> — <div class='inline'><p>The length</p> </div> </li> <li> <span class='name'>offset</span> <span class='type'>(<tt>Integer</tt>)</span> <em class="default">(defaults to: <tt>0</tt>)</em> — <div class='inline'><p>(Optional) The width to pad each subsequent line</p> </div> </li> <li> <span class='name'>prefix</span> <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span> <em class="default">(defaults to: <tt>''</tt>)</em> — <div class='inline'><p>(Optional) A prefix to add to each line</p> </div> </li> </ul> </div> </div> </div> </div> <div id="footer"> Generated on Fri Mar 10 15:19:58 2023 by <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.9.28 (ruby-3.0.1). </div> </div> </body> </html>