Posted over 11 years ago. Visible to the public.

Generate a Unicode nonbreaking space in Ruby

Regular spaces and non-breaking spaces are hard to distinguish for a human.
Instead of using the   HTML entity or code like " " # this is an nbsp, use a well-named helper method instead.

Copy
def nbsp [160].pack('U*') end

160 is the ASCII character code of a non-breaking space.

Your development team has a full backlog of feature requests, chores and refactoring coupled with deadlines? We are familiar with that. With our "DevOps as a Service" offering, we support developer teams with infrastructure and operations expertise.

Owner of this card:

Avatar
Arne Hartherz
Last edit:
over 4 years ago
by Arne Hartherz
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more