Class: SayTimeAction
- Inherits:
-
DateTimeAction
- Object
- MacroObject
- Action
- DateTimeAction
- SayTimeAction
- Defined in:
- lib/ruby-macrodroid.rb
Overview
Category: Date/Time
Instance Attribute Summary
Attributes inherited from Action
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ SayTimeAction
constructor
A new instance of SayTimeAction.
- #invoke ⇒ Object
- #to_pc ⇒ Object
- #to_s(colour: false) ⇒ Object
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ SayTimeAction
Returns a new instance of SayTimeAction.
3286 3287 3288 3289 3290 3291 3292 3293 3294 |
# File 'lib/ruby-macrodroid.rb', line 3286 def initialize(h={}) = { :'12_hour' => true } super(.merge h) end |
Instance Method Details
#invoke ⇒ Object
3296 3297 3298 3299 3300 |
# File 'lib/ruby-macrodroid.rb', line 3296 def invoke() time = ($env and $env[:time]) ? $env[:time] : Time.now tformat = @h['12_hour'] ? "%-I:%M%P" : "%H:%M" super(time.strftime(tformat)) end |
#to_pc ⇒ Object
3302 3303 3304 |
# File 'lib/ruby-macrodroid.rb', line 3302 def to_pc() 'say current_time()' end |
#to_s(colour: false) ⇒ Object
3306 3307 3308 |
# File 'lib/ruby-macrodroid.rb', line 3306 def to_s(colour: false) 'Say Current Time' end |