class ScrolldownController < ApplicationController # def first_time # session[:separator]='`' # session[:choices]=nil # redirect_to :action => "index" # end def get_title 'scroll text down' end def get_separator '`' end def get_choices t=get_text b=get_overflow shiftrx=[/.$/, /..$/, #last char(s) /\w+\W*$/, #last word /[.?!;][\w ,]+$/, #last sentence /\n[\w ,]+$/] #last para c=[] #choices shiftrx.each do |r| if t=~r c<< $~.pre_match + '||' +$~.to_s+b end end c.uniq end def reformat_choices end def selected(str) session[:text],session[:overflow]= str.split('||') s="scrolldown #{session[:text]}||#{session[:overflow]}" logger.info(s) logger.info("str #{str}") session[:choices]=nil end def extras @text=get_text @overflow=get_overflow end end