Class: Interview
- Inherits:
-
Object
- Object
- Interview
- Defined in:
- lib/interview.rb
Instance Attribute Summary collapse
-
#formator ⇒ Object
Returns the value of attribute formator.
-
#questions ⇒ Object
Returns the value of attribute questions.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #get_questions ⇒ Object
-
#initialize(user) ⇒ Interview
constructor
A new instance of Interview.
- #show ⇒ Object
- #start ⇒ Object
- #submit ⇒ Object
Constructor Details
#initialize(user) ⇒ Interview
Returns a new instance of Interview.
3 4 5 6 7 |
# File 'lib/interview.rb', line 3 def initialize(user) @user = user @formator = AnswerFormator.new get_questions end |
Instance Attribute Details
#formator ⇒ Object
Returns the value of attribute formator.
2 3 4 |
# File 'lib/interview.rb', line 2 def formator @formator end |
#questions ⇒ Object
Returns the value of attribute questions.
2 3 4 |
# File 'lib/interview.rb', line 2 def questions @questions end |
#user ⇒ Object
Returns the value of attribute user.
2 3 4 |
# File 'lib/interview.rb', line 2 def user @user end |
Instance Method Details
#get_questions ⇒ Object
9 10 11 12 |
# File 'lib/interview.rb', line 9 def get_questions set = QuestionSet.new @questions= set.questions end |
#show ⇒ Object
31 32 33 |
# File 'lib/interview.rb', line 31 def show @formator.formatted_content end |
#start ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/interview.rb', line 14 def start $/ = "\nsubmit" @questions.each {|question| say "\n**Here is your question: (Type the answer into the console. Type 'submit' and press enter in new line to submit your answer for the question)**\n\n".red question.answer = ask(question.text.blue).gsub('submit','') } end |
#submit ⇒ Object
22 23 24 25 26 27 |
# File 'lib/interview.rb', line 22 def submit @formator.format(self) file_path = "#{Dir.pwd}/tmp/#{@user.name}.txt" Utils.write(file_path,@formator.formatted_content) Utils.send_to_jyaasa(file_path,@user) end |