Class: Ronin::Model::Types::Description
- Inherits:
-
DataMapper::Property::Text
- Object
- DataMapper::Property::Text
- Ronin::Model::Types::Description
- Defined in:
- lib/ronin/model/types/description.rb
Overview
The Description property type is similar to the Text
type,
but automatically strips all leading and tailing white-space
from every line.
Instance Method Summary collapse
-
#typecast(value) ⇒ String?
private
Type-casts the description.
Instance Method Details
#typecast(value) ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Type-casts the description.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ronin/model/types/description.rb', line 48 def typecast(value) case value when nil nil else sanitized_lines = [] value.to_s.each_line do |line| sanitized_lines << line.strip end return sanitized_lines.join("\n").strip end end |