Class: Teems::Commands::OooScheduleEntry

Inherits:
Data
  • Object
show all
Defined in:
lib/teems/commands/ooo.rb

Overview

A parsed –start or –end value. Produces ISO datetime strings for auto-reply schedules and calendar events. Kind is :timed, :date, or :unscheduled; value is a Time, Date, or nil respectively.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



55
56
57
# File 'lib/teems/commands/ooo.rb', line 55

def kind
  @kind
end

#valueObject (readonly)

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



55
56
57
# File 'lib/teems/commands/ooo.rb', line 55

def value
  @value
end

Instance Method Details

#all_day?Boolean

Returns:

  • (Boolean)


57
# File 'lib/teems/commands/ooo.rb', line 57

def all_day? = kind == :date

#event_end_isoObject



73
74
75
76
77
78
# File 'lib/teems/commands/ooo.rb', line 73

def event_end_iso
  base = value || Date.today
  return base.strftime('%Y-%m-%dT%H:%M:%S') if timed?

  "#{base + 1}T00:00:00"
end

#event_start_isoObject



68
69
70
71
# File 'lib/teems/commands/ooo.rb', line 68

def event_start_iso
  base = value || Date.today
  timed? ? base.strftime('%Y-%m-%dT%H:%M:%S') : "#{base}T00:00:00"
end

#reply_end_isoObject



64
65
66
# File 'lib/teems/commands/ooo.rb', line 64

def reply_end_iso
  timed? ? value.strftime('%Y-%m-%dT%H:%M:%S') : "#{value}T23:59:59"
end

#reply_start_isoObject



60
61
62
# File 'lib/teems/commands/ooo.rb', line 60

def reply_start_iso
  timed? ? value.strftime('%Y-%m-%dT%H:%M:%S') : "#{value}T00:00:00"
end

#timed?Boolean

Returns:

  • (Boolean)


56
# File 'lib/teems/commands/ooo.rb', line 56

def timed? = kind == :timed

#unscheduled?Boolean

Returns:

  • (Boolean)


58
# File 'lib/teems/commands/ooo.rb', line 58

def unscheduled? = kind == :unscheduled