Class: LightLevelConstraint
- Inherits:
-
Constraint
- Object
- MacroObject
- Constraint
- LightLevelConstraint
- Defined in:
- lib/ruby-macrodroid/constraints.rb
Overview
Category: Sensors
Instance Attribute Summary
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ LightLevelConstraint
constructor
A new instance of LightLevelConstraint.
- #to_s(colour: false, indent: 0) ⇒ Object
Methods inherited from Constraint
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ LightLevelConstraint
Returns a new instance of LightLevelConstraint.
1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 |
# File 'lib/ruby-macrodroid/constraints.rb', line 1277 def initialize(h={}) = { light_level: -1, light_level_float: 5000.0, option: 1 } super(.merge h) end |
Instance Method Details
#to_s(colour: false, indent: 0) ⇒ Object
1289 1290 1291 1292 1293 1294 1295 |
# File 'lib/ruby-macrodroid/constraints.rb', line 1289 def to_s(colour: false, indent: 0) operator = @h[:light_level] == -1 ? 'Less than' : 'Greater than' condition = operator + ' ' + @h[:light_level_float].to_s + 'lx' 'Light Sensor ' + condition end |