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.



4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
# File 'lib/ruby-macrodroid.rb', line 4218

def initialize(h={})

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

  super(options.merge h)

end

Instance Method Details

#to_sObject



4229
4230
4231
4232
# File 'lib/ruby-macrodroid.rb', line 4229

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