Ruby/html trick: wrap long strings with invisible wordwrap characters
def wrap_long_string(text,max_width = 20)
(text.length < max_width) ?
text :
text.scan(/.{1,#{max_width}}/).join(“<wbr>“)
end
This blog is about startups, blogging, Ruby On Rails, virtualization and cloud computing, photography, customer service, marketing, ux and design, git, and lots more.
Get updates by email
Follow me on twitter
Accessible, manageable, virtualized application stacks ready to download or deploy to the cloud!
Reach me at yan at pritzker.ws
def wrap_long_string(text,max_width = 20)
(text.length < max_width) ?
text :
text.scan(/.{1,#{max_width}}/).join(“<wbr>“)
end
© skwpspace. Powered by WordPress using a DePo Clean Theme modified by Yan Pritzker.