-
Notifications
You must be signed in to change notification settings - Fork 23
/
overrides.rb
83 lines (81 loc) · 2.04 KB
/
overrides.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
module EdgeCase
class << self
def simple_output; false; end
end
module Color
module_function
# def use_colors?
# false
# end
# COLORS.each do |color, value|
# module_eval %{def #{color}(string); "<div style='color:#{color};'>\#\{string\}</div>"; end}
# module_function color
# end
COLORS = {
:clear => 0, :black => 30, :red => 31,
:green => 32, :yellow => 33, :blue => 34,
:magenta => 35, :cyan => 36,
}
def method_missing(method_name,string)
"<div style='color:#{method_name};'>\#\{string\}</div>"
end
end
class Koan
def self.command_line(args)
#do nothing
end
end
class Sensei
attr_reader :instructions
def puts(message='')
instructions << message unless (message.nil? || message.start_with?('Please meditate'))
end
def progress
[5]
end
def instructions
@instructions ||= []
end
def indent(text)
text = text.split(/\n/) if text.is_a?(String)
[text].flatten.collect{|t| " #{t}"}
end
def observe(step)
if step.passed?
@pass_count += 1
if @pass_count > progress.last.to_i
# @observations << Color.green("#{step.koan_file}##{step.name} has expanded your awareness.")
end
else
# @failed_test = step
failures[step.name] = step.failure
# add_progress(@pass_count)
# @observations << Color.red("#{step.koan_file}##{step.name} has damaged your karma.")
# throw :edgecase_exit
end
end
def guide_through_error
# puts "The answers you seek..."
# puts Color.red(indent(failure.message).join)
end
def failures
@failures ||= {}
end
def embolden_first_line_only(text)
# do not print stacktrace
end
end
class ThePath
attr_accessor :sensei
def walk
#do nothing
end
def online_walk
@sensei = EdgeCase::Sensei.new
each_step do |step|
@sensei.observe(step.meditate)
end
sensei.instruct
end
end
end