Class: Rcms::Mention
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Rcms::Mention
- Defined in:
- lib/generators/templates_mentions/app/models/rcms/mention.rb
Instance Method Summary collapse
Instance Method Details
#get_short_desc(l = 110) ⇒ Object
9 10 11 |
# File 'lib/generators/templates_mentions/app/models/rcms/mention.rb', line 9 def get_short_desc l = 110 truncate(text, l) end |
#truncate(text, l = 110) ⇒ Object
13 14 15 16 17 |
# File 'lib/generators/templates_mentions/app/models/rcms/mention.rb', line 13 def truncate text, l = 110 return nil if text.nil? text = ActionView::Base.full_sanitizer.sanitize(text) text.length > l ? text.truncate(l) : text end |