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, indent: 0) ⇒ Object
Methods included from ObjectX
#action_to_object, #object_create, #varify
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ SayTimeAction
Returns a new instance of SayTimeAction.
907 908 909 910 911 912 913 914 915 |
# File 'lib/ruby-macrodroid/actions.rb', line 907 def initialize(h={}) = { :'12_hour' => true } super(.merge h) end |
Instance Method Details
#invoke ⇒ Object
917 918 919 920 921 922 |
# File 'lib/ruby-macrodroid/actions.rb', line 917 def invoke() #time = ($env and $env[:time]) ? $env[:time] : Time.now time = Time.now tformat = @h['12_hour'] ? "%-I:%M%P" : "%H:%M" super(txt: time.strftime(tformat)) end |
#to_pc ⇒ Object
924 925 926 |
# File 'lib/ruby-macrodroid/actions.rb', line 924 def to_pc() 'say current_time()' end |
#to_s(colour: false, indent: 0) ⇒ Object
928 929 930 |
# File 'lib/ruby-macrodroid/actions.rb', line 928 def to_s(colour: false, indent: 0) 'Say Current Time' end |