method

cut_excerpt_part

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActionView::Helpers::TextHelper
cut_excerpt_part(part_position, part, separator, options) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionview/lib/action_view/helpers/text_helper.rb, line 540
        def cut_excerpt_part(part_position, part, separator, options)
          return "", "" unless part

          radius   = options.fetch(:radius, 100)
          omission = options.fetch(:omission, "...")

          if separator != ""
            part = part.split(separator)
            part.delete("")
          end

          affix = part.length > radius ? omission : ""

          part =
            if part_position == :first
              part.last(radius)
            else
              part.first(radius)
            end

          if separator != ""
            part = part.join(separator)
          end

          return affix, part
        end
Register or log in to add new notes.