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 inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ StopWatchAction

Returns a new instance of StopWatchAction.



739
740
741
742
743
744
745
746
747
748
# File 'lib/ruby-macrodroid/actions.rb', line 739

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



750
751
752
753
754
755
# File 'lib/ruby-macrodroid/actions.rb', line 750

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