Class: Barr::Blocks::Clock
- Inherits:
-
Barr::Block
- Object
- Barr::Block
- Barr::Blocks::Clock
- Defined in:
- lib/barr/blocks/clock.rb
Instance Attribute Summary
Attributes inherited from Barr::Block
#align, #bgcolor, #fgcolor, #icon, #interval, #output
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Clock
constructor
A new instance of Clock.
- #update! ⇒ Object
Methods inherited from Barr::Block
#<<, #colors, #destroy, #destroy!, #draw, #reassign_deprecated_option, #update
Constructor Details
#initialize(opts = {}) ⇒ Clock
Returns a new instance of Clock.
7 8 9 10 |
# File 'lib/barr/blocks/clock.rb', line 7 def initialize(opts = {}) super @format = opts[:format] || '%H:%M %d %b %Y' end |
Instance Method Details
#update! ⇒ Object
12 13 14 |
# File 'lib/barr/blocks/clock.rb', line 12 def update! @output = Time.now.strftime(@format) end |