class SayTimeAction
Category: Date/Time
Public Class Methods
new(obj=nil)
click to toggle source
Calls superclass method
DateTimeAction::new
# File lib/ruby-macrodroid/actions.rb, line 1011 def initialize(obj=nil) h = if obj.is_a? Hash then obj elsif obj.is_a? Array e, macro = obj {:'12_hour' => e.text('item/description').to_s[/^\d+/] == '12'} end options = { :'12_hour' => true } super(options.merge h) end
Public Instance Methods
invoke()
click to toggle source
Calls superclass method
Action#invoke
# File lib/ruby-macrodroid/actions.rb, line 1030 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()
click to toggle source
# File lib/ruby-macrodroid/actions.rb, line 1037 def to_pc() 'say current_time()' end
to_s(colour: false, indent: 0)
click to toggle source
Calls superclass method
MacroObject#to_s
# File lib/ruby-macrodroid/actions.rb, line 1041 def to_s(colour: false, indent: 0) @s = 'Say Current Time' @s += "\n%s hour clock" % (@h[:'12_hour'] ? '12' : '24') super() end