app/models/studentdb/course.rb
def parse_to_time(t)
    if t.is_a?(Time)
      t = Time.parse(t.to_s(:time))
    elsif t.is_a?(String) && t.include?(":")
      t = Time.parse(t)
    elsif t.is_a?(String)
      t = Time.parse(t.insert(-3, ":"))
    elsif t.is_a?(Numeric)
      t = Time.parse(t.to_s.insert(-3, ":"))
    else
      raise Exception.new("Invalid parameter")
    end
  end
# Parse an unformatted time into a valid time object. Accepts:
# 
# * Ruby Time objects
# * Strings like "11:30" or "0120"
# * Numbers like 1020 or 0215
# 
# Remember that you need to provide 24-hour times to this method. If you need to convert an SDB-style time to
# 24-hour time, use #sdb_course_convert_time first.
Parse an unformatted time into a valid time object. Accepts:
Ruby Time objects
Strings like "11:30" or "0120"
Numbers like 1020 or 0215

Remember that you need to provide 24-hour times to this method. If you need to convert an SDB-style time to
24-hour time, use #sdb_course_convert_time first.
Parse an unformatted time into a valid time object . Accepts : Ruby Time objects Strings like " 11 : 30 " or " 0120 " Numbers like 1020 or 0215 Remember that you need to provide 24 - hour times to this method . If you need to convert an SDB - style time to 24 - hour time use #sdb_course_convert_time first .
def parse_to_time(t)
    if t.is_a?(Time)
      t = Time.parse(t.to_s(:time))
    elsif t.is_a?(String) && t.include?(":")
      t = Time.parse(t)
    elsif t.is_a?(String)
      t = Time.parse(t.insert(-3, ":"))
    elsif t.is_a?(Numeric)
      t = Time.parse(t.to_s.insert(-3, ":"))
    else
      raise Exception.new("Invalid parameter")
    end
  end
def parse_to_time ( t ) if t . is_a? ( Time ) t = Time . parse ( t . to_s ( :time ) ) elsif t . is_a? ( String ) && t . include? ( ":" ) t = Time . parse ( t ) elsif t . is_a? ( String ) t = Time . parse ( t . insert ( - 3 , ":" ) ) elsif t . is_a? ( Numeric ) t = Time . parse ( t . to_s . insert ( - 3 , ":" ) ) else raise Exception . new ( "Invalid parameter" ) end end
Parse an unformatted time into a valid time object.
Parse an unformatted time into a valid time object .
t