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 included from ObjectX

#action_to_object, #object_create, #varify

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ SetWifiAction

Returns a new instance of SetWifiAction.



810
811
812
813
814
815
816
817
818
819
820
# File 'lib/ruby-macrodroid/actions.rb', line 810

def initialize(h={})

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

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false, indent: 0) ⇒ Object



822
823
824
825
826
827
828
829
830
831
832
# File 'lib/ruby-macrodroid/actions.rb', line 822

def to_s(colour: false, indent: 0)    
  
  @s = if @h[:state] <= 2 then
    state = %w(Enable Disable Toggle)[@h[:state]]      
    state + ' Wifi'
  else
    "Connected to Network\n%s" % @h[:ssid]
  end
  
  super()
end