Module: Xqsr3::StringUtilities::Truncate

Included in:
String
Defined in:
lib/xqsr3/string_utilities/truncate.rb

Overview

To-symbol conversion facilities

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.string_truncate(s, width, options = {}) ⇒ Object

Truncates the given string s to the given width according to the given options

Signature

  • Parameters:

    • s (+String+) The string to convert;
    • width (+Integer+) The truncation width;
    • options (+Hash+) Options that control the behaviour of the method;
  • Options:

    • :omission (+String+) Omission string. Defaults to "...";


115
116
117
118
# File 'lib/xqsr3/string_utilities/truncate.rb', line 115

def self.string_truncate s, width, options = {}

  Truncate_Helper_.string_truncate_with_options_ s, width, options
end

Instance Method Details

#truncate(width, options = {}) ⇒ Object

Truncates the instance, according to the given width and options

See Xqsr3::StringUtilities::ToSymbol::string_truncate for options



123
124
125
126
# File 'lib/xqsr3/string_utilities/truncate.rb', line 123

def truncate width, options = {}

  Truncate_Helper_.string_truncate_with_options_ self, width, options
end