watch_file does not call the the correct handler

14 views
Skip to first unread message

Vince Chew

unread,
Jul 6, 2014, 11:29:08 PM7/6/14
to eventm...@googlegroups.com

 Hi guys

I am new to Ruby.

I am following the example: https://github.com/Shopify/dashing/issues/78#issuecomment-14940695

The eventmachine.watch_file triggers the method "file_deleted" everytime I modify the spreadsheet. I am expecting it to call the method "file_modified" from the Handler module instead.

I paste the Handler code which I add the comments in there to show me which method was being called when the application is running

Can someone help me please. Thank you so much.




module Handler

  def file_modified

  puts "In File Modified"

    fetch_spreadsheet_data(path)

  end

  def file_moved

  puts "In File Moved"

    fetch_spreadsheet_data(path)

  end

  def file_deleted

  puts "In File Deleted - Why am I being called all the time even though the file is modified and not deleted?"

    fetch_spreadsheet_data(path)

  end  

  def unbind

    puts "#{path} monitoring ceased"

  end

end

Reply all
Reply to author
Forward
0 new messages