class Constraint
This file contains the following classes:
## Constraint classes Constraint TimeOfDayConstraint BatteryLevelConstraint BatterySaverStateConstraint BatteryTemperatureConstraint ExternalPowerConstraint BluetoothConstraint GPSEnabledConstraint LocationModeConstraint SignalOnOffConstraint WifiConstraint CellTowerConstraint IsRoamingConstraint DataOnOffConstraint WifiHotSpotConstraint CalendarConstraint DayOfWeekConstraint TimeOfDayConstraint DayOfMonthConstraint MonthOfYearConstraint SunsetSunriseConstraint AirplaneModeConstraint AutoRotateConstraint DeviceLockedConstraint RoamingOnOffConstraint TimeSinceBootConstraint AutoSyncConstraint NFCStateConstraint IsRootedConstraint VpnConstraint MacroEnabledConstraint ModeConstraint TriggerThatInvokedConstraint LastRunTimeConstraint HeadphonesConnectionConstraint MusicActiveConstraint NotificationPresentConstraint PriorityModeConstraint NotificationVolumeConstraint InCallConstraint PhoneRingingConstraint BrightnessConstraint VolumeConstraint SpeakerPhoneConstraint DarkThemeConstraint ScreenOnOffConstraint VolumeLevelConstraint FaceUpDownConstraint LightLevelConstraint DeviceOrientationConstraint ProximitySensorConstraint
Public Class Methods
new(h={})
click to toggle source
Calls superclass method
MacroObject::new
# File lib/ruby-macrodroid/constraints.rb, line 30 def initialize(h={}) super(h) end
Public Instance Methods
match?(detail={}, model=nil)
click to toggle source
# File lib/ruby-macrodroid/constraints.rb, line 34 def match?(detail={}, model=nil) detail.select {|k,v| @h.include? k }.all? {|key,value| @h[key] == value} end
Protected Instance Methods
toggle_match?(key, val)
click to toggle source
def to_s()
''
end
# File lib/ruby-macrodroid/constraints.rb, line 46 def toggle_match?(key, val) if @h[key] == true and val == key.to_s then true elsif @h[key] == false and val != key.to_s true else false end end