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 MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ SayTimeAction
constructor
A new instance of SayTimeAction.
- #invoke ⇒ Object
- #to_pc ⇒ Object
- #to_s ⇒ Object
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ SayTimeAction
Returns a new instance of SayTimeAction.
2184 2185 2186 2187 2188 2189 2190 2191 2192 |
# File 'lib/ruby-macrodroid.rb', line 2184 def initialize(h={}) = { :'12_hour' => true } super(.merge h) end |
Instance Method Details
#invoke ⇒ Object
2194 2195 2196 2197 2198 |
# File 'lib/ruby-macrodroid.rb', line 2194 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
2200 2201 2202 |
# File 'lib/ruby-macrodroid.rb', line 2200 def to_pc() 'say current_time()' end |
#to_s ⇒ Object
2204 2205 2206 |
# File 'lib/ruby-macrodroid.rb', line 2204 def to_s() 'Say Current Time' end |