lib/tty/text.rb in tty-0.0.11 vs lib/tty/text.rb in tty-0.1.0

- old
+ new

@@ -1,16 +1,14 @@ -# -*- encoding: utf-8 -*- +# encoding: utf-8 module TTY - # A class responsible for text manipulations class Text + SPACE = ' ' - SPACE = " ".freeze + NEWLINE = "\n" - NEWLINE = "\n".freeze - DEFAULT_WIDTH = 80.freeze # Specifies the split mode for words def split_mode end @@ -22,13 +20,13 @@ # # @param [String] second # the second string for comparison # # @example - # distance("which", "witch") - # # => 2 + # distance("which", "witch") # => 2 # + # @api public def self.distance(first, second, *args) Distance.new(first, second, *args).distance end # Wrap a text into lines no longer than provided length @@ -48,14 +46,14 @@ # # @example # wrap("Some longish text", 8) # # => "Some\nlongish\ntext" # - # wrap("Some longish text", :length => 8) + # wrap("Some longish text", length: 8) # # => "Some\nlongish\ntext" # - # wrap("Some longish text", 8, :indent => 4) + # wrap("Some longish text", 8, indent: 4) # # => > Some # > longish # > text # # @api public @@ -94,8 +92,7 @@ # # @api public def self.truncate(text, *args) Truncation.new(text, *args).truncate end - end # Text end # TTY