Class: NFCTrigger

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 Trigger

#match?

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(obj = nil) ⇒ NFCTrigger

Returns a new instance of NFCTrigger.



1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
# File 'lib/ruby-macrodroid/triggers.rb', line 1042

def initialize(obj=nil)
  
  h = if obj.is_a? Hash then
    obj
  elsif obj.is_a? Array
    e, macro = obj
    {tag_name: e.text('item/description').to_s}
  end 
  
  options = {
  }

  super(options.merge h)

end

Instance Method Details

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



1058
1059
1060
# File 'lib/ruby-macrodroid/triggers.rb', line 1058

def to_s(colour: false)
  'NFC Tag' + "\n  " + @h[:tag_name]
end