Class: ExternalPowerConstraint

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

Overview

Category: Battery/Power

Instance Attribute Summary

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Constraint

#match?

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ ExternalPowerConstraint

Returns a new instance of ExternalPowerConstraint.



4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
# File 'lib/ruby-macrodroid.rb', line 4871

def initialize(h={})

  options = {
    external_power: true,
    power_connected_options: [false, true, false]
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false) ⇒ Object



4882
4883
4884
4885
# File 'lib/ruby-macrodroid.rb', line 4882

def to_s(colour: false)
  connection = @h[:external_power] ? 'Connected' : 'Disconnected'
  'Power ' + connection
end