Class: Icalendar::Values::Uri
- Inherits:
-
Icalendar::Value
- Object
- SimpleDelegator
- Icalendar::Value
- Icalendar::Values::Uri
- Defined in:
- lib/icalendar/values/uri.rb
Direct Known Subclasses
Constant Summary collapse
- CONTROL_BYTES_REGEX =
/[\x00-\x1F\x7F]/.freeze
Constants inherited from Icalendar::Value
Icalendar::Value::VALUE_TYPE_GSUB_REGEX_1, Icalendar::Value::VALUE_TYPE_GSUB_REGEX_2
Instance Attribute Summary
Attributes inherited from Icalendar::Value
Instance Method Summary collapse
-
#initialize(value, *args) ⇒ Uri
constructor
A new instance of Uri.
- #value_ical ⇒ Object
Methods inherited from Icalendar::Value
#==, #ical_param, #params_ical, #to_ical, #value, value_type, #value_type
Constructor Details
#initialize(value, *args) ⇒ Uri
Returns a new instance of Uri.
11 12 13 14 |
# File 'lib/icalendar/values/uri.rb', line 11 def initialize(value, *args) parsed = URI.parse(value) rescue value super parsed, *args end |
Instance Method Details
#value_ical ⇒ Object
16 17 18 |
# File 'lib/icalendar/values/uri.rb', line 16 def value_ical value.to_s.gsub(CONTROL_BYTES_REGEX) { |char| "%%%02X" % char.ord } end |