Skip to content

Instantly share code, notes, and snippets.

@qizwiz
Created September 27, 2011 16:46
Show Gist options
  • Save qizwiz/1245584 to your computer and use it in GitHub Desktop.
Save qizwiz/1245584 to your computer and use it in GitHub Desktop.
class Question% a attr_accessor :key, :answers% a % a def initialize(session, key)% a self.key = key% a @answers = session[:answers] ||= {}% a end% a % a def save_answer% a # save answer logic% a end% a % a def get_results% a # get results logic% a end% a % a class << self% a def find(session, key = nil)% a keys = [ :one, :two, :three, :four, :five, :six, :seven ]% a key = key.to_s.downcase.strip.to_sym% a % a if(keys.include?(key))% a Question.new(session, key)% a else% a nil% a end% a end% a end% aend% a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment