Class: AirplaneModeConstraint
- Inherits:
-
Constraint
- Object
- MacroObject
- Constraint
- AirplaneModeConstraint
- Defined in:
- lib/ruby-macrodroid.rb
Overview
Category: Device State
Instance Attribute Summary
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ AirplaneModeConstraint
constructor
A new instance of AirplaneModeConstraint.
- #match?(detail = {}, model = nil) ⇒ Boolean
- #to_pc ⇒ Object
- #to_s ⇒ Object
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ AirplaneModeConstraint
3990 3991 3992 3993 3994 3995 3996 3997 3998 |
# File 'lib/ruby-macrodroid.rb', line 3990 def initialize(h={}) = { enabled: true } super(.merge h) end |
Instance Method Details
#match?(detail = {}, model = nil) ⇒ Boolean
4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 |
# File 'lib/ruby-macrodroid.rb', line 4000 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 ⇒ Object
4023 4024 4025 4026 |
# File 'lib/ruby-macrodroid.rb', line 4023 def to_pc() status = @h[:enabled] ? 'enabled?' : 'disabled?' 'airplane_mode.' + status end |
#to_s ⇒ Object
4028 4029 4030 4031 4032 4033 |
# File 'lib/ruby-macrodroid.rb', line 4028 def to_s() status = @h[:enabled] ? 'Enabled' : 'Disabled' 'Airplane Mode ' + status end |