Class: WifiConstraint
- Inherits:
- 
      Constraint
      
        - Object
- MacroObject
- Constraint
- WifiConstraint
 
- Defined in:
- lib/ruby-macrodroid/constraints.rb
Overview
Category: Connectivity
Instance Attribute Summary
Attributes inherited from MacroObject
Instance Method Summary collapse
- 
  
    
      #initialize(h = {})  ⇒ WifiConstraint 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of WifiConstraint. 
- #to_s(colour: false, indent: 0) ⇒ Object (also: #to_summary)
Methods inherited from Constraint
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ WifiConstraint
Returns a new instance of WifiConstraint.
| 290 291 292 293 294 295 296 297 298 299 | # File 'lib/ruby-macrodroid/constraints.rb', line 290 def initialize(h={}) = { ssid_list: [], wifi_state: 0 } super(.merge h) end | 
Instance Method Details
#to_s(colour: false, indent: 0) ⇒ Object Also known as: to_summary
| 301 302 303 304 305 306 307 308 309 310 311 312 | # File 'lib/ruby-macrodroid/constraints.rb', line 301 def to_s(colour: false, indent: 0) state = ['Enabled','Disabled','Connected', 'Not Connected'][@h[:wifi_state]] @s = 'Wifi ' + state + ': ' if @h[:ssid_list].length > 1 then @s += "[%s]" % @h[:ssid_list].join(', ') elsif @h[:ssid_list].length > 0 @s += @h[:ssid_list].first end end |