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.



4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
# File 'lib/ruby-macrodroid.rb', line 4857

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



4868
4869
4870
4871
# File 'lib/ruby-macrodroid.rb', line 4868

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