Class: UBXDSupportRota::Shift

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Shift

Returns a new instance of Shift.



7
8
9
10
# File 'lib/ubxd_support_rota/shift.rb', line 7

def initialize(attributes = {})
  @name = attributes["name"]
  @comment = attributes["comment"]
end

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



5
6
7
# File 'lib/ubxd_support_rota/shift.rb', line 5

def comment
  @comment
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/ubxd_support_rota/shift.rb', line 5

def name
  @name
end

Instance Method Details

#to_sObject



12
13
14
# File 'lib/ubxd_support_rota/shift.rb', line 12

def to_s
  "<name: \"#{@name}\" comment: \"#{@comment}\">"
end

#to_wiki_format(previous_shift, date) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/ubxd_support_rota/shift.rb', line 16

def to_wiki_format(previous_shift, date)
  values = [date.strftime("%e %b %Y"), previous_shift.name] + [name] * 6 + [comment||""]
  <<EOT % values
! %s
| %s ||  %s || %s  || %s  ||  %s || %s || %s || %s
|-
EOT
end