Archive: ComponentOwl Rails app, DB backups, go redirect script
This commit is contained in:
21
app/helpers/notifier_helper.rb
Normal file
21
app/helpers/notifier_helper.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
module NotifierHelper
|
||||
|
||||
def survey(survey)
|
||||
keys = survey.keys.sort {|x, y| x.to_i <=> y.to_i }
|
||||
questions = []
|
||||
|
||||
keys.each do |key|
|
||||
item = survey[key]
|
||||
str = "#{key}. #{item[:question]}\n"
|
||||
if item[:answer].is_a? Array
|
||||
str += item[:answer].join(", ")
|
||||
else
|
||||
str += item[:answer] || ""
|
||||
end
|
||||
questions << str
|
||||
end
|
||||
|
||||
questions.join("\n\n")
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user