Class: ExternalPowerConstraint

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

Overview

Category: Battery/Power

Instance Attribute Summary

Attributes inherited from MacroObject

#options, #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.



4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
# File 'lib/ruby-macrodroid.rb', line 4077

def initialize(h={})

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

  super(options.merge h)

end

Instance Method Details

#to_sObject



4088
4089
4090
4091
# File 'lib/ruby-macrodroid.rb', line 4088

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