Class: StopWatchAction

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

#invoke

Methods included from ObjectX

#action_to_object, #object_create, #varify

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ StopWatchAction

Returns a new instance of StopWatchAction.



981
982
983
984
985
986
987
988
989
990
# File 'lib/ruby-macrodroid/actions.rb', line 981

def initialize(h={})

  options = {
    stopwatch_name: 'timer1',
    option: 0
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false, indent: 0) ⇒ Object Also known as: to_summary



992
993
994
995
996
997
# File 'lib/ruby-macrodroid/actions.rb', line 992

def to_s(colour: false, indent: 0)
  option = ['Start', 'Pause','Reset','Reset and Restart'][@h[:option]]
  name = @h[:stopwatch_name]
  @s = "StopWatch (%s)" % option + "\n" + name #+ ' ' + @h.inspect
  super()
end