Class: SayTimeAction

Inherits:
DateTimeAction show all
Defined in:
lib/ruby-macrodroid.rb

Overview

Category: Date/Time

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from MacroObject

#to_h

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={})

  options = {
    :'12_hour' => true
  }

  super(options.merge h)

end

Instance Method Details

#invokeObject



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_pcObject



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