Class: Crony::Formatters::DayOfMonthFormatter

Inherits:
CronStruct
  • Object
show all
Defined in:
lib/crony/formatters/day_of_month_formatter.rb

Instance Method Summary collapse

Methods inherited from CronStruct

#collection?, #every?, #format, #frequency?, #range?, #single_element, #single_element?, #unbounded_range?

Instance Method Details

#c(lead_in = true) ⇒ Object



16
17
18
# File 'lib/crony/formatters/day_of_month_formatter.rb', line 16

def c(lead_in=true)
  "#{"on the " if lead_in}#{collection.map(&:ordinal).to_sentence}"
end

#eObject



20
21
22
# File 'lib/crony/formatters/day_of_month_formatter.rb', line 20

def e
  "on every day"
end

#fObject



24
25
26
# File 'lib/crony/formatters/day_of_month_formatter.rb', line 24

def f
  "#{v} from #{range}"
end

#lObject



28
29
30
# File 'lib/crony/formatters/day_of_month_formatter.rb', line 28

def l
  "on the last day"
end

#ordinalObject



4
# File 'lib/crony/formatters/day_of_month_formatter.rb', line 4

def ordinal; self.single_element.ordinal; end

#rObject



32
33
34
# File 'lib/crony/formatters/day_of_month_formatter.rb', line 32

def r
  "on #{range}"
end

#rangeObject



6
7
8
# File 'lib/crony/formatters/day_of_month_formatter.rb', line 6

def range
  "the #{self.start.ordinal} to the #{self.stop.ordinal}"
end

#s(lead_in = true) ⇒ Object



36
37
38
# File 'lib/crony/formatters/day_of_month_formatter.rb', line 36

def s(lead_in=true)
  "#{"on the " if lead_in}#{ordinal}"
end

#symObject



10
11
12
13
14
# File 'lib/crony/formatters/day_of_month_formatter.rb', line 10

def sym
  return 'w' if !!nearest
  return 'l' if !!last
  super
end

#uObject



40
41
42
# File 'lib/crony/formatters/day_of_month_formatter.rb', line 40

def u
  "#{v} starting on the #{start.ordinal}"
end

#vObject



44
45
46
# File 'lib/crony/formatters/day_of_month_formatter.rb', line 44

def v
  "on every #{frequency.ordinal} day"
end

#wObject



48
49
50
# File 'lib/crony/formatters/day_of_month_formatter.rb', line 48

def w
  "on the weekday closest to the #{ordinal}"
end