class AbcdController < ApplicationController def get_title translate('type') end def get_separator '|' end def start_choices ['a|b|c|d|_|!','e|f|g|h|.|,','i|j|k|l|m|n', 'o|p|q|r|s|t','u|v|w|x|y|z','*|+|?|^|$|\|'] end def selected(str) str.gsub!(/_/," ") session[:text]<< str nil end def extras @text=get_text lw=last_word(@text.strip) if lw.empty? @words=get_starting_words(get_sentences_dir) #word candidates else rx_str=lw.split("").join(".*") rx=Regexp.new(rx_str,Regexp::IGNORECASE) wd=get_words_dir # logger.info("words rx:"+rx_str) @words=get_matching_words(wd,rx) - [lw] @words.sort! { |x,y| x.size <=> y.size } end end def replace @text=get_text.strip st=params[:id] if last_word(@text).empty? session[:text]=@text+ " #{st} " else @text.gsub!(/\w+$/,st) session[:text]=@text+' ' end what_next end def backspace session[:text].chop! what_next end end