Class: LightLevelConstraint

Inherits:
Constraint show all
Defined in:
lib/ruby-macrodroid.rb

Overview

Category: Sensors

Instance Attribute Summary

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Constraint

#match?

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ LightLevelConstraint

Returns a new instance of LightLevelConstraint.



5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
# File 'lib/ruby-macrodroid.rb', line 5873

def initialize(h={})

  options = {
    light_level: -1,
    light_level_float: 5000.0,
    option: 1
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false) ⇒ Object



5885
5886
5887
5888
5889
5890
5891
# File 'lib/ruby-macrodroid.rb', line 5885

def to_s(colour: false)
  
  operator = @h[:light_level] == -1 ? 'Less than' : 'Greater than'    
  condition = operator + ' ' + @h[:light_level_float].to_s + 'lx'
  'Light Sensor ' + condition
  
end