Module: Vobject
- Defined in:
- lib/vobject.rb,
lib/vobject/version.rb,
lib/vobject/parameter.rb,
lib/vobject/propertyvalue.rb,
lib/vobject/parametervalue.rb,
lib/vobject/vcalendar/propertyvalue.rb
Defined Under Namespace
Modules: Vcalendar Classes: Component, Parameter, ParameterValue, Property, PropertyValue
Constant Summary collapse
- MAX_LINE_WIDTH =
75
- VERSION =
"1.1.0".freeze
Class Method Summary collapse
-
.fold_line(line) ⇒ Object
This implements the line folding as specified in tools.ietf.org/html/rfc6350#section-3.2 NOTE: the “line” here is not including the trailing n.
- .unfold(str) ⇒ Object
Instance Method Summary collapse
Class Method Details
.fold_line(line) ⇒ Object
This implements the line folding as specified in tools.ietf.org/html/rfc6350#section-3.2 NOTE: the “line” here is not including the trailing n
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/vobject.rb', line 11 def fold_line(line) folded_line = line[0, MAX_LINE_WIDTH] remainder_line = line[MAX_LINE_WIDTH, line.length - MAX_LINE_WIDTH] || "" max_width = MAX_LINE_WIDTH - 1 (0..((remainder_line.length - 1) / max_width)).each do |i| folded_line << "\n " folded_line << remainder_line[i * max_width, max_width] end folded_line end |
.unfold(str) ⇒ Object
4 5 6 |
# File 'lib/vobject.rb', line 4 def unfold(str) str.gsub(/(\r|\n|\r\n)[ \t]/, "") end |
Instance Method Details
#to_s ⇒ Object
9 10 11 |
# File 'lib/vobject/parametervalue.rb', line 9 def to_s value end |