Update dialog_sample.rb

updated complex method and split menu creation into extra functions