Class: ActionsNlp

Inherits:
Object
  • Object
show all
Includes:
AppRoutes
Defined in:
lib/ruby-macrodroid.rb

Instance Method Summary collapse

Constructor Details

#initialize ⇒ ActionsNlp

Returns a new instance of ActionsNlp.



74
75
76
77
78
79
80
# File 'lib/ruby-macrodroid.rb', line 74

def initialize()

  super()
  params = {}
  actions(params)

end

Instance Method Details

#actions(params) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/ruby-macrodroid.rb', line 82

def actions(params) 

  get /^message popup: (.*)/i do |msg|
    [ToastAction, {msg: msg}]
  end

  get /^Popup[ _]Message ['"]([^'"]+)/i do |msg|
    [ToastAction, {msg: msg}]
  end
  
  get /^say current[ _]time/i do
    [SayTimeAction, {}]
  end    
  
  get /^Torch :?(.*)/i do |onoffstate|
    state = onoffstate.downcase == 'on' ? 0 : 1
    [CameraFlashLightAction, {state: state}]
  end    
  
  get /^Take Picture/i do
    [TakePictureAction, {}]
  end
  
  get /^take_picture/i do
    [TakePictureAction, {}]
  end           

end