Class: Barabara::Modules::Clock
- Inherits:
-
Object
- Object
- Barabara::Modules::Clock
- Includes:
- Wisper::Publisher
- Defined in:
- lib/barabara/modules/clock.rb
Instance Attribute Summary collapse
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize ⇒ Clock
constructor
A new instance of Clock.
- #watch ⇒ Object
Constructor Details
#initialize ⇒ Clock
Returns a new instance of Clock.
6 7 8 9 10 11 |
# File 'lib/barabara/modules/clock.rb', line 6 def initialize config = GlobalConfig.config.module_config('clock') colors = GlobalConfig.config.colors @format = format(config['format'], colors) || '%F %R' @time = Time.now end |
Instance Attribute Details
#time ⇒ Object (readonly)
Returns the value of attribute time.
13 14 15 |
# File 'lib/barabara/modules/clock.rb', line 13 def time @time end |
Instance Method Details
#watch ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/barabara/modules/clock.rb', line 15 def watch loop do update push sleep 5 end end |