Class: PauseAction

Inherits:
Action show all
Defined in:
lib/ruby-macrodroid/actions.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 included from ObjectX

#action_to_object, #object_create, #varify

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ PauseAction

Returns a new instance of PauseAction.



1818
1819
1820
1821
1822
1823
1824
1825
# File 'lib/ruby-macrodroid/actions.rb', line 1818

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, indent: 0) ⇒ Object



1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
# File 'lib/ruby-macrodroid/actions.rb', line 1827

def to_s(colour: false, indent: 0)
  
  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