Class: BatteryLevelConstraint
- Inherits:
-
Constraint
- Object
- MacroObject
- Constraint
- BatteryLevelConstraint
- Defined in:
- lib/ruby-macrodroid.rb
Overview
Category: Battery/Power
Instance Attribute Summary
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ BatteryLevelConstraint
constructor
A new instance of BatteryLevelConstraint.
- #to_s ⇒ Object
Methods inherited from Constraint
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ BatteryLevelConstraint
Returns a new instance of BatteryLevelConstraint.
4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 |
# File 'lib/ruby-macrodroid.rb', line 4011 def initialize(h={}) = { battery_level: 23, equals: false, greater_than: false } super(.merge h) end |
Instance Method Details
#to_s ⇒ Object
4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 |
# File 'lib/ruby-macrodroid.rb', line 4023 def to_s() operator = if @h[:greater_than] then '>' elsif @h[:equals] '=' else '<' end level = @h[:battery_level] "Battery %s %s%%" % [operator, level] end |