Class: PauseAction

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

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Action

#invoke

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ PauseAction

Returns a new instance of PauseAction.



3912
3913
3914
3915
3916
3917
3918
3919
# File 'lib/ruby-macrodroid.rb', line 3912

def initialize(h={})
  
  options = {
    delay_in_milli_seconds: 0, delay_in_seconds: 1, use_alarm: false
  }
  super(h)
  
end

Instance Method Details

#to_s(colour: false) ⇒ Object



3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
# File 'lib/ruby-macrodroid.rb', line 3921

def to_s(colour: false)
  
  su = Subunit.new(units={minutes:60, hours:60}, 
                   seconds: @h[:delay_in_seconds])

  ms = @h[:delay_in_milli_seconds]
  
  duration = if su.to_h.has_key?(:minutes) or (ms < 1) then
    su.strfunit("%X")
  else
    "%s %s ms" % [su.strfunit("%X"), ms]
  end
  
  "Wait " + duration
end