<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yan Pritzker &#187; html</title>
	<atom:link href="http://yanpritzker.com/category/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://yanpritzker.com</link>
	<description>photographer, entrepreneur, software engineer, musician, skier</description>
	<lastBuildDate>Fri, 13 Aug 2010 23:38:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ruby/html trick: wrap long strings with invisible wordwrap characters</title>
		<link>http://yanpritzker.com/2008/05/13/rubyhtml-trick-wrap-long-strings-with-invisible-wordwrap-characters/</link>
		<comments>http://yanpritzker.com/2008/05/13/rubyhtml-trick-wrap-long-strings-with-invisible-wordwrap-characters/#comments</comments>
		<pubDate>Tue, 13 May 2008 22:23:44 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[thoughts]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://skwpspace.com/2008/05/13/rubyhtml-trick-wrap-long-strings-with-invisible-wordwrap-characters/</guid>
		<description><![CDATA[def wrap_long_string(text,max_width = 20)
  (text.length &#60; max_width) ?
    text :
    text.scan(/.{1,#{max_width}}/).join("&#60;wbr&#62;")
end

]]></description>
			<content:encoded><![CDATA[<pre class="textmate-source black_pearl"><span class="source source_ruby source_ruby_rails"><span class="meta meta_rails meta_rails_helper"><span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">wrap_long_string</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">text<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span>max_width <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="constant constant_numeric constant_numeric_ruby">20</span></span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
  <span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>text<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>length <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">&lt;</span> max_width<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span> <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">?</span>
    text <span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">:</span>
    text<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>scan<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_regexp string_regexp_classic string_regexp_classic_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby">/</span><span class="constant constant_character constant_character_escape constant_character_escape_ruby">.</span>{1,<span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>max_width<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span>}<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby">/</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>join<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>&lt;wbr&gt;<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
</span><span class="keyword keyword_control keyword_control_ruby">end</span>
</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2008/05/13/rubyhtml-trick-wrap-long-strings-with-invisible-wordwrap-characters/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.250 seconds -->
