Class: Mo2tex::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/mo2tex/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ls, le, ln, lt, t, desc, loc, online) ⇒ Event

Returns a new instance of Event.



11
12
13
14
15
16
17
18
19
20
# File 'lib/mo2tex/event.rb', line 11

def initialize(ls, le, ln, lt, t, desc, loc, online)
    @dtstart = DateTime.parse(ls.to_s)
    @dtend   = DateTime.parse(le.to_s)
    @lnumber = ln
    @ltot    = lt
    @title   = t
    @desc    = desc
    @loc     = loc
    @online  = online
end

Instance Attribute Details

#descObject (readonly)

Returns the value of attribute desc.



9
10
11
# File 'lib/mo2tex/event.rb', line 9

def desc
  @desc
end

#dtendObject (readonly)

Returns the value of attribute dtend.



9
10
11
# File 'lib/mo2tex/event.rb', line 9

def dtend
  @dtend
end

#dtstartObject (readonly)

Returns the value of attribute dtstart.



9
10
11
# File 'lib/mo2tex/event.rb', line 9

def dtstart
  @dtstart
end

#lnumberObject (readonly)

Returns the value of attribute lnumber.



9
10
11
# File 'lib/mo2tex/event.rb', line 9

def lnumber
  @lnumber
end

#locObject (readonly)

Returns the value of attribute loc.



9
10
11
# File 'lib/mo2tex/event.rb', line 9

def loc
  @loc
end

#ltotObject (readonly)

Returns the value of attribute ltot.



9
10
11
# File 'lib/mo2tex/event.rb', line 9

def ltot
  @ltot
end

#onlineObject (readonly)

Returns the value of attribute online.



9
10
11
# File 'lib/mo2tex/event.rb', line 9

def online
  @online
end

#titleObject (readonly)

Returns the value of attribute title.



9
10
11
# File 'lib/mo2tex/event.rb', line 9

def title
  @title
end

Instance Method Details

#colorObject



56
57
58
# File 'lib/mo2tex/event.rb', line 56

def color
  return "\"green\""
end

#to_ical(ical) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/mo2tex/event.rb', line 26

def to_ical(ical)
  ical.event do
    |e|
    e.dtstart = self.dtstart
    e.dtend   = self.dtend
    e.summary = self.title
    e.description = self.desc
    e.location = self.loc
    e.ip_class = 'PUBLIC'
    if is_online?
      e.location = 'Microsoft Teams Meeting'
      e.description += <<EOR
\n_____________________________________________________________
 ___________________\nMicrosoft Teams Need help?<https://aka.ms/JoinTeamsMe
 eting?omkt=en-US>\nJoin the meeting now<https://teams.microsoft.com/l/meet
 up-join/19%3ameeting_MWZlZDdkZmMtNjRkNi00M2U3LTgwMzUtMjkwNGQ1YTY3N2I4%40th
 read.v2/0?context=%7b%22Tid%22%3a%2276c57fd2-8d47-4cb5-a7a2-83c2cd0c3565%2
 2%2c%22Oid%22%3a%22a29bd7f0-b99d-4031-8cf5-fabe578a7d05%22%7d>\nMeeting ID
 : 358 935 834 932\nPasscode: 9wNLge\n________________________________\nFor
  organizers: Meeting options<https://teams.microsoft.com/meetingOptions/?o
 rganizerId=a29bd7f0-b99d-4031-8cf5-fabe578a7d05&tenantId=76c57fd2-8d47-4cb
 5-a7a2-83c2cd0c3565&threadId=19_meeting_MWZlZDdkZmMtNjRkNi00M2U3LTgwMzUtMj
 [email protected]&messageId=0&language=en-US>\n____________________
 ____________________________________________________________\n
EOR
    end
  end
  return ical
end

#to_sObject



22
23
24
# File 'lib/mo2tex/event.rb', line 22

def to_s
  return self.title + ' ' + self.dtstart.strftime("%d/%m/%Y %H:%M") + '-' + self.dtend.strftime("%H:%M") + ' ' + self.lnumber.to_s + '/' + self.ltot.to_s
end