Class: UBXDSupportRota::Shift
- Inherits:
-
Object
- Object
- UBXDSupportRota::Shift
- Defined in:
- lib/ubxd_support_rota/shift.rb
Instance Attribute Summary collapse
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Shift
constructor
A new instance of Shift.
- #to_s ⇒ Object
- #to_wiki_format(previous_shift, date) ⇒ Object
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
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
5 6 7 |
# File 'lib/ubxd_support_rota/shift.rb', line 5 def comment @comment end |
#name ⇒ Object (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_s ⇒ Object
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 |