Class: GuessMethod::GuessMethodOutputter
- Defined in:
- lib/guessmethod/outputter.rb
Overview
GuessMethodOutputter uses a little Formatter class for colorization
Defined Under Namespace
Classes: Formatter
Class Method Summary collapse
-
.ambigious_const(sym, possibilities, obj) ⇒ Object
:nodoc:.
-
.ambigous_rake_task(task, possibilities) ⇒ Object
:nodoc:.
-
.ambiguous_method(meth, possibilities, obj) ⇒ Object
:nodoc:.
-
.no_const_in_threshold(sym, obj) ⇒ Object
:nodoc:.
-
.no_method_in_threshold(meth, obj) ⇒ Object
:nodoc:.
-
.no_rake_task_in_threshold(task) ⇒ Object
:nodoc:.
-
.object(obj) ⇒ Object
:nodoc:.
-
.replacing_const(sym, call_const, obj) ⇒ Object
:nodoc:.
-
.replacing_method(meth, call_method, obj) ⇒ Object
:nodoc:.
-
.replacing_rake_task(task, call_task) ⇒ Object
:nodoc:.
Class Method Details
.ambigious_const(sym, possibilities, obj) ⇒ Object
:nodoc:
56 57 58 59 60 61 62 63 64 |
# File 'lib/guessmethod/outputter.rb', line 56 def self.ambigious_const(sym, possibilities, obj) #:nodoc: Formatter.color('ambigious constant:', :red) << ' ' << Formatter.color(sym, :green) << ', possible matches ' << possibilities.map {|m| Formatter.color(m, :cyan)}.join(', ') << ' for ' << Formatter.color(obj, :green, :bold) end |
.ambigous_rake_task(task, possibilities) ⇒ Object
:nodoc:
96 97 98 99 100 101 102 |
# File 'lib/guessmethod/outputter.rb', line 96 def self.ambigous_rake_task(task, possibilities) #:nodoc: Formatter.color('ambigious rake task:', :red) << ' ' << Formatter.color(task, :green) << ', possible matches ' << possibilities.map {|m| Formatter.color(m, :cyan)}.join(', ') end |
.ambiguous_method(meth, possibilities, obj) ⇒ Object
:nodoc:
29 30 31 32 33 34 35 36 37 |
# File 'lib/guessmethod/outputter.rb', line 29 def self.ambiguous_method(meth, possibilities, obj) #:nodoc: Formatter.color('ambigious method:', :red) << ' ' << Formatter.color(meth, :green) << ', possible matches ' << possibilities.map {|m| Formatter.color(m, :cyan)}.join(', ') << ' for ' << GuessMethodOutputter.object(obj) end |
.no_const_in_threshold(sym, obj) ⇒ Object
:nodoc:
66 67 68 69 70 71 |
# File 'lib/guessmethod/outputter.rb', line 66 def self.no_const_in_threshold(sym, obj) #:nodoc: Formatter.color('no constant in threshold: ', :red) << Formatter.color(sym, :green) << ' for ' << Formatter.color(obj, :green, :bold) end |
.no_method_in_threshold(meth, obj) ⇒ Object
:nodoc:
39 40 41 42 43 44 |
# File 'lib/guessmethod/outputter.rb', line 39 def self.no_method_in_threshold(meth, obj) #:nodoc: Formatter.color('no method in threshold: ', :red) << Formatter.color(meth, :green) << ' for ' << GuessMethodOutputter.object(obj) end |
.no_rake_task_in_threshold(task) ⇒ Object
:nodoc:
91 92 93 94 |
# File 'lib/guessmethod/outputter.rb', line 91 def self.no_rake_task_in_threshold(task) #:nodoc: Formatter.color('no rake task in threshold: ', :red) << Formatter.color(task, :green) end |
.object(obj) ⇒ Object
:nodoc:
20 21 22 23 24 25 26 27 |
# File 'lib/guessmethod/outputter.rb', line 20 def self.object(obj) #:nodoc: inspected = obj.inspect if obj.inspect.length > GuessMethodOptions[:max_inspect_length] Formatter.color("#<#{obj.class}:0x#{(obj.object_id*2).to_s(16)}>", :green) else Formatter.color(obj.inspect, :green, :bold) << ':' << Formatter.color(obj.class, :green) end end |
.replacing_const(sym, call_const, obj) ⇒ Object
:nodoc:
73 74 75 76 77 78 79 80 81 |
# File 'lib/guessmethod/outputter.rb', line 73 def self.replacing_const(sym, call_const, obj) #:nodoc: Formatter.color('attention:', :red) << ' replacing non-existant constant ' << Formatter.color(sym, :cyan) << ' with ' << Formatter.color(call_const, :cyan) << ' for ' << Formatter.color(obj, :green, :bold) end |
.replacing_method(meth, call_method, obj) ⇒ Object
:nodoc:
46 47 48 49 50 51 52 53 54 |
# File 'lib/guessmethod/outputter.rb', line 46 def self.replacing_method(meth, call_method, obj) #:nodoc: Formatter.color('attention:', :red) << ' sending ' << Formatter.color(call_method, :cyan) << ' instead of ' << Formatter.color(meth, :cyan) << ' to ' << GuessMethodOutputter.object(obj) end |
.replacing_rake_task(task, call_task) ⇒ Object
:nodoc:
83 84 85 86 87 88 89 |
# File 'lib/guessmethod/outputter.rb', line 83 def self.replacing_rake_task(task, call_task) #:nodoc: Formatter.color('attention:', :red) << ' invoking task ' << Formatter.color(call_task, :cyan) << ' instead of ' << Formatter.color(task, :cyan) end |