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(colour: false) ⇒ Object (also: #to_summary)
Methods inherited from Constraint
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ BatteryLevelConstraint
Returns a new instance of BatteryLevelConstraint.
4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 |
# File 'lib/ruby-macrodroid.rb', line 4778 def initialize(h={}) = { battery_level: 23, equals: false, greater_than: false } super(.merge h) end |
Instance Method Details
#to_s(colour: false) ⇒ Object Also known as: to_summary
4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 |
# File 'lib/ruby-macrodroid.rb', line 4790 def to_s(colour: false) operator = if @h[:greater_than] then '>' elsif @h[:equals] '=' else '<' end level = @h[:battery_level] "Battery %s %s%%" % [operator, level] end |