Module: Ical::Event

Defined in:
lib/jquery/ical/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#all_dayObject



88
89
90
# File 'lib/jquery/ical/event.rb', line 88

def all_day
  @all_day ||= ical_event.x_properties["X-MICROSOFT-CDO-ALLDAYEVENT"][0] ? 1 : 0
end

#descriptionObject



82
83
84
# File 'lib/jquery/ical/event.rb', line 82

def description
  @description ||= ical_event.description
end

#locationObject



76
77
78
# File 'lib/jquery/ical/event.rb', line 76

def location
  @location ||= ical_event.location
end

#summaryObject



70
71
72
# File 'lib/jquery/ical/event.rb', line 70

def summary
  @summary ||= ical_event.summary
end

Instance Method Details

#end_dateObject



48
49
50
# File 'lib/jquery/ical/event.rb', line 48

def end_date
  @end_date ||= I18n.l(Date.parse(ends_at.to_s))
end

#end_date=(string_date) ⇒ Object



52
53
54
55
56
57
# File 'lib/jquery/ical/event.rb', line 52

def end_date=(string_date)
  if parsed = DateTime.parse("#{string_date} #{end_time}") rescue nil
    @ends_at = parsed
  end
  @end_date = string_date
end

#end_timeObject



59
60
61
# File 'lib/jquery/ical/event.rb', line 59

def end_time
  @end_time ||= I18n.l(Time.parse(ends_at.to_s), :format => :time)
end

#end_time=(string_time) ⇒ Object



63
64
65
66
67
68
# File 'lib/jquery/ical/event.rb', line 63

def end_time=(string_time)
  if parsed = DateTime.parse("#{end_date} #{string_time}") rescue nil
    @ends_at = parsed
  end
  @end_time = string_time
end

#ends_atObject



39
40
41
# File 'lib/jquery/ical/event.rb', line 39

def ends_at
  @ends_at ||= ical_event.dtend ? ical_event.dtend.to_datetime : starts_at + 60.minutes
end

#ends_at=(date_time) ⇒ Object



43
44
45
46
# File 'lib/jquery/ical/event.rb', line 43

def ends_at=(date_time)
  @end_time = @end_date = nil
  @ends_at = date_time
end

#ical_eventObject



4
5
6
# File 'lib/jquery/ical/event.rb', line 4

def ical_event
  @ical_event ||= RiCal.parse_string(ical_string || '').first || RiCal.Event
end

#start_dateObject



17
18
19
# File 'lib/jquery/ical/event.rb', line 17

def start_date
  @start_date ||= I18n.l(Date.parse(starts_at.to_s))
end

#start_date=(string_date) ⇒ Object



21
22
23
24
25
26
# File 'lib/jquery/ical/event.rb', line 21

def start_date=(string_date)
  if parsed = DateTime.parse("#{string_date} #{start_time}") rescue nil
    @starts_at = parsed
  end
  @start_date = string_date
end

#start_timeObject



28
29
30
# File 'lib/jquery/ical/event.rb', line 28

def start_time
  @start_time ||= I18n.l(Time.parse(starts_at.to_s), :format => :time)
end

#start_time=(string_time) ⇒ Object



32
33
34
35
36
37
# File 'lib/jquery/ical/event.rb', line 32

def start_time=(string_time)
  if parsed = DateTime.parse("#{start_date} #{string_time}") rescue nil
    @starts_at = parsed
  end
  @start_time = string_time
end

#starts_atObject



8
9
10
# File 'lib/jquery/ical/event.rb', line 8

def starts_at
  @starts_at ||= ical_event.dtstart ? ical_event.dtstart.to_datetime : DateTime.now
end

#starts_at=(date_time) ⇒ Object



12
13
14
15
# File 'lib/jquery/ical/event.rb', line 12

def starts_at=(date_time)
  @start_time = @start_date = nil
  @starts_at = date_time
end