Module: RiCal::CoreExtensions::String::Conversions

Included in:
String
Defined in:
lib/ri_cal/core_extensions/string/conversions.rb

Overview

  • ©2009 Rick DeNatale

  • All rights reserved. Refer to the file README.txt for the license

Instance Method Summary collapse

Instance Method Details

#camelizeObject

Convert the receiver to camelized form This method duplicates the method provided by ActiveSupport, and will only be defined by the RiCal gem if it is not already defined.



25
26
27
# File 'lib/ri_cal/core_extensions/string/conversions.rb', line 25

def camelize
  self.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
end

#to_ri_cal_date_time_valueObject Also known as: to_ri_cal_date_or_date_time_value

Parse the receiver as an RiCal::PropertyValue::DateTime



9
10
11
# File 'lib/ri_cal/core_extensions/string/conversions.rb', line 9

def to_ri_cal_date_time_value
  RiCal::PropertyValue::DateTime.from_string(self)
end

#to_ri_cal_duration_valueObject

Parse the receiver as an RiCal::PropertyValue::DurationValue



16
17
18
# File 'lib/ri_cal/core_extensions/string/conversions.rb', line 16

def to_ri_cal_duration_value
  RiCal::PropertyValue::Duration.from_string(self)
end