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.
4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 |
# File 'lib/ruby-macrodroid.rb', line 4151 def initialize(h={}) = { battery_level: 23, equals: false, greater_than: false } super(.merge h) end |
Instance Method Details
#to_s ⇒ Object
4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 |
# File 'lib/ruby-macrodroid.rb', line 4163 def to_s() operator = if @h[:greater_than] then '>' elsif @h[:equals] '=' else '<' end level = @h[:battery_level] "Battery %s %s%%" % [operator, level] end |