class AirplaneModeConstraint

Category: Device State

Public Class Methods

new(h={}) click to toggle source
Calls superclass method Constraint::new
# File lib/ruby-macrodroid/constraints.rb, line 571
def initialize(h={})

  options = {
    enabled: true
  }

  super(options.merge h)

end

Public Instance Methods

match?(detail={}, model=nil) click to toggle source
Calls superclass method Constraint#match?
# File lib/ruby-macrodroid/constraints.rb, line 581
def match?(detail={}, model=nil)
  
  puts 'inside airplaneModeConstraint#match?' if $debug
  
  if detail.has_key? :enabled then
    
    puts 'detail has the key' if $debug
    super(detail)
    
  elsif model
    
    if $debug then
      puts 'checking the model'
      switch = model.connectivity.airplane_mode.switch
      puts 'switch: ' + switch.inspect
    end
    
    toggle_match?(:enabled, switch)
    
  end
  
end
to_pc() click to toggle source
# File lib/ruby-macrodroid/constraints.rb, line 604
def to_pc()
  status = @h[:enabled] ? 'enabled?' : 'disabled?'
  'airplane_mode.' + status
end
to_s(colour: false, indent: 0) click to toggle source
# File lib/ruby-macrodroid/constraints.rb, line 609
def to_s(colour: false, indent: 0)
  
  status = @h[:enabled] ? 'Enabled' : 'Disabled'
  'Airplane Mode ' + status
  
end
Also aliased as: to_summary
to_summary(colour: false, indent: 0)
Alias for: to_s