Here is an example of what I'm trying to do:
def 9() run_playback_command(NINE_COMMAND) end
I would like it to be because it was to be used later:
if(channelNumber != nil) splitChannel = "#{channelNumber}".split(//) if(splitChannel[3] != nil) response = "#{splitChannel[3]}"() end if(splitChannel[2] != nil) response = "#{splitChannel[2]}"() end if(splitChannel[1] != nil) response = "#{splitChannel[1]}"() end if(splitChannel[0] != nil) response = "#{splitChannel[0]}"() end end
Sorry to bother if this is a simple question! I am very new to Ruby.
Edit:
Here is what I'm trying to get Siri to do:
if(phrase.match(/(switch to |go to )channel (.+)\s (on )?(the )?(directv|direct tv)( dvr| receiver)?/i)) self.plugin_manager.block_rest_of_session_from_server response = nil if(phrase.match(/channel \s([0-9]+|zero|one|two|three|four|five|six|seven|eight|nine)/)) channelNumber = $1 if(channelNumber.to_i == 0) channelNumber = map_siri_numbers_to_int(channelNumber) end channelNumber.to_s.each_char{ |c| run_playback_command(COMMAND[c]) } end
No wonder he doesn't read the channel. Help?
source share