Class: WeekdayNum

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

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ WeekdayNum

Initializes a WeekdayNum objects. It accepts a Java WeekdayNum object (com.google.ical.values.WeekdayNum) or the number of the week and the day of the week



10
11
12
13
14
15
16
17
18
19
# File 'lib/weekday_num.rb', line 10

def initialize(*args)
  if args.size == 1
    @weekdaynum = args[0]
  elsif args.size == 2
    num = args[0]
    wday = args[1]
    @weekdaynum = JWeekdayNum.new(num, Weekday::MAP[wday.to_s.downcase])
  end
  self
end

Instance Method Details

#==(weekdaynum) ⇒ Object



29
30
31
# File 'lib/weekday_num.rb', line 29

def ==(weekdaynum)
  @weekdaynum.equals(weekdaynum.to_java)
end

#to_icalObject



21
22
23
# File 'lib/weekday_num.rb', line 21

def to_ical
  @weekdaynum.toIcal
end

#to_javaObject



33
34
35
# File 'lib/weekday_num.rb', line 33

def to_java
  @weekdaynum
end

#to_sObject



25
26
27
# File 'lib/weekday_num.rb', line 25

def to_s
  @weekdaynum.toString
end