Class: SayTimeAction
- Inherits:
-
DateTimeAction
- Object
- MacroObject
- Action
- DateTimeAction
- SayTimeAction
- Defined in:
- lib/ruby-macrodroid/actions.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.
574 575 576 577 578 579 580 581 582 |
# File 'lib/ruby-macrodroid/actions.rb', line 574 def initialize(h={}) = { :'12_hour' => true } super(.merge h) end |
Instance Method Details
#invoke ⇒ Object
584 585 586 587 588 |
# File 'lib/ruby-macrodroid/actions.rb', line 584 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
590 591 592 |
# File 'lib/ruby-macrodroid/actions.rb', line 590 def to_pc() 'say current_time()' end |
#to_s(colour: false) ⇒ Object
594 595 596 |
# File 'lib/ruby-macrodroid/actions.rb', line 594 def to_s(colour: false) 'Say Current Time' end |