Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/gcal4ruby/recurrence.rb

Overview

Author

Mike Reich ([email protected])

Copyright

Copyright © 2010 Mike Reich

License

GPL v2

– Licensed under the General Public License (GPL), Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Feel free to use and update, but be sure to contribute your code back to the project and attribute as required by the license. ++

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse_complete(value) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gcal4ruby/recurrence.rb', line 26

def self.parse_complete(value)
  unless value.nil? || value.empty?
    if value.include?("T")
      d, h = value.split("T")
      return Time.parse(d+" "+h.to_s.gsub("Z", ""))
    else
      value = value.to_s
      return Time.parse("#{value[0..3]}-#{value[4..5]}-#{value[6..7]}")
    end
  end
end

Instance Method Details

#completeObject

Returns a ISO 8601 complete formatted string of the time



22
23
24
# File 'lib/gcal4ruby/recurrence.rb', line 22

def complete
  self.utc.strftime("%Y%m%dT%H%M%S")
end