Class: BaseCodeAI
- Inherits:
-
Object
show all
- Defined in:
- lib/asker/code/ai/base_code_ai.rb
Instance Method Summary
collapse
Instance Method Details
#clone_array(array) ⇒ Object
14
15
16
17
18
|
# File 'lib/asker/code/ai/base_code_ai.rb', line 14
def clone_array(array)
out = []
array.each { |item| out << item.dup }
out
end
|
#find_make_methods ⇒ Object
36
37
38
39
40
41
|
# File 'lib/asker/code/ai/base_code_ai.rb', line 36
def find_make_methods
list = self.public_methods.sort
list.select! { |name| name.to_s.start_with? 'make_'}
list.delete(:make_questions)
list
end
|
#lines_to_html(lines) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/asker/code/ai/base_code_ai.rb', line 28
def lines_to_html(lines)
out = ''
lines.each_with_index do |line,index|
out << "%2d: #{line}</br>"%(index+1)
end
out
end
|
#lines_to_s(lines) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/asker/code/ai/base_code_ai.rb', line 20
def lines_to_s(lines)
out = ''
lines.each_with_index do |line,index|
out << "%2d: #{line}\n"%(index+1)
end
out
end
|
#make_questions ⇒ Object
43
44
45
46
47
|
# File 'lib/asker/code/ai/base_code_ai.rb', line 43
def make_questions
list = find_make_methods
list.each { |m| @questions += self.send m }
@questions
end
|
#name ⇒ Object
6
7
8
|
# File 'lib/asker/code/ai/base_code_ai.rb', line 6
def name
File.basename(@data_object.filename)
end
|
#num ⇒ Object
10
11
12
|
# File 'lib/asker/code/ai/base_code_ai.rb', line 10
def num
@num += 1
end
|