Module: Truncato
- Defined in:
- lib/truncato/version.rb,
lib/truncato/truncato.rb
Constant Summary collapse
- VERSION =
'0.7.13'
- DEFAULT_OPTIONS =
{ max_length: 30, count_tags: true, tail: "...", filtered_attributes: [] }
- ARTIFICIAL_ROOT_NAME =
'truncato-artificial-root'
Class Method Summary collapse
-
.truncate(source, user_options = {}) ⇒ String
Truncates the source XML string and returns the truncated XML.
Class Method Details
.truncate(source, user_options = {}) ⇒ String
Truncates the source XML string and returns the truncated XML. It will keep a valid XML structure and insert a tail text indicating the position where content were removed (…).
21 22 23 24 |
# File 'lib/truncato/truncato.rb', line 21 def self.truncate source, ={} = DEFAULT_OPTIONS.merge() self.truncate_html(source, ) || self.truncate_no_html(source, ) end |