module Augmented::Strings::Truncatable
Public Instance Methods
truncate(length)
click to toggle source
# File lib/augmented/strings/truncatable.rb, line 6 def truncate length raise ArgumentError, 'length must be a non-negative integer' unless length && length.to_int >= 0 slice(0, length) end
truncate!(length)
click to toggle source
# File lib/augmented/strings/truncatable.rb, line 12 def truncate! length replace(truncate(length)) self end