Class: ScreenOnOffTrigger

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

Overview

Category: Device Events

Instance Attribute Summary

Attributes inherited from Trigger

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ ScreenOnOffTrigger

Returns a new instance of ScreenOnOffTrigger.



1212
1213
1214
1215
1216
1217
1218
1219
1220
# File 'lib/ruby-macrodroid/triggers.rb', line 1212

def initialize(h={})

  options = {
    screen_on: true
  }

  super(options.merge h)

end

Instance Method Details

#match?(detail = {}, model = nil) ⇒ Boolean

Returns:

  • (Boolean)


1222
1223
1224
1225
# File 'lib/ruby-macrodroid/triggers.rb', line 1222

def match?(detail={}, model=nil)
  #@h[:screen_on] == detail[:screen_on]
  true
end

#to_s(colour: false) ⇒ Object Also known as: to_summary



1227
1228
1229
# File 'lib/ruby-macrodroid/triggers.rb', line 1227

def to_s(colour: false)
  'Screen ' + (@h[:screen_on] ? 'On' : 'Off')
end