Class: SetWifiAction

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

Overview

Category: Connectivity

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 = {}) ⇒ SetWifiAction



393
394
395
396
397
398
399
400
401
402
403
# File 'lib/ruby-macrodroid/actions.rb', line 393

def initialize(h={})

  options = {
    ssid: '[Select Wifi]',
    network_id: 0,
    state: 0
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false) ⇒ Object



405
406
407
408
# File 'lib/ruby-macrodroid/actions.rb', line 405

def to_s(colour: false)
  action = @h[:state] == 0 ? 'Enable' : 'Disable'
  action + ' Wifi'
end