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
Returns a new instance of AirplaneModeConstraint.
4505 4506 4507 4508 4509 4510 4511 4512 4513 |
# File 'lib/ruby-macrodroid.rb', line 4505 def initialize(h={}) = { enabled: true } super(.merge h) end |
Instance Method Details
#match?(detail = {}, model = nil) ⇒ Boolean
4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 |
# File 'lib/ruby-macrodroid.rb', line 4515 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
4538 4539 4540 4541 |
# File 'lib/ruby-macrodroid.rb', line 4538 def to_pc() status = @h[:enabled] ? 'enabled?' : 'disabled?' 'airplane_mode.' + status end |
#to_s ⇒ Object
4543 4544 4545 4546 4547 4548 |
# File 'lib/ruby-macrodroid.rb', line 4543 def to_s() status = @h[:enabled] ? 'Enabled' : 'Disabled' 'Airplane Mode ' + status end |