Sha256: 7185ab6da5807cf3cfe5dab4dbffc0a9660d0eacf6682112a09f4a1f92e7f68d
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
require 'manilla/folder' require 'manilla/unfolder' require 'manilla/version' module Manilla # # Breaks long lines of text into multiple delimited representations. # # @example Fold text on character # Manilla.fold('Hello, world!', 8, "\r\n\s") # => Hello, w # orld! # # @example Fold text on word # Manilla.fold('Hello, world!', 8, "\r\n\s", :word) # => Hello, # world! # # @param text [String] The text to be folded # @param maxwidth [Integer] The maximum length of a line of text # @param delimiter [String] String used to denote line boundaries # @param break_on [Symbol] Specifies whether to fold text on a character # (`:char`) or word (`:word`) (default: `:char`) # def self.fold(text, maxwidth, delimiter, break_on = :char) Manilla::Folder.call(text, maxwidth, delimiter, break_on) end # # Moves from a folded delimited representation to a single line # representation by treating delimiters as blank strings. # # @example Unfold text # text = "Hello, world!" # # folded_text = Manilla.fold(text, 8, "\r\n", :word) # => Hello, # world! # # Manilla.unfold(folded_text, "\r\n") # => Hello, world! # # @param text [String] Text to be unfolded # @param delimiter [String] String used to denote line boundaries # def self.unfold(text, delimiter) Manilla::Unfolder.call(text, delimiter) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
manilla-1.0.0 | lib/manilla.rb |