Class | AbcdController |
In: |
app/controllers/abcd_controller.rb
|
Parent: | ApplicationController |
# File app/controllers/abcd_controller.rb, line 49 49: def backspace 50: session[:text].chop! 51: redirect_to :action => "index" 52: end
# File app/controllers/abcd_controller.rb, line 22 22: def extras 23: @text=get_text 24: lw=last_word(@text.strip) 25: if lw.empty? 26: @words=Giver.new. 27: get_starting_words(SentencesDir) 28: #word candidates 29: else 30: rx_str=lw.split("").join(".*") 31: rx=Regexp.new(rx_str,Regexp::IGNORECASE) 32: # logger.info("words rx:"+rx_str) 33: g=Giver.new 34: @words=g.get_matching_words(WordsDir,rx) - [lw] 35: @words.sort! { |x,y| x.size <=> y.size } 36: end 37: end
# File app/controllers/abcd_controller.rb, line 2 2: def first_time 3: session[:choices]= nil 4: session[:selected_item]=0 5: redirect_to :action => "index" 6: end
# File app/controllers/abcd_controller.rb, line 38 38: def replace 39: @text=get_text.strip 40: st=params[:id] 41: if last_word(@text).empty? 42: session[:text]=@text+ " #{st} " 43: else 44: @text.gsub!(/\w+$/,st) 45: session[:text]=@text+' ' 46: end 47: redirect_to :action => "index" 48: end
# File app/controllers/abcd_controller.rb, line 17 17: def selected(str) 18: str.gsub!(/_/," ") 19: session[:text]<< str 20: session[:choices]=nil 21: end