Class: GuessMethod::GuessMethodOutputter
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:.
-
.ambiguous_method(meth, possibilities, obj) ⇒ Object
:nodoc:.
-
.no_const_in_threshold(sym, obj) ⇒ Object
:nodoc:.
-
.no_method_in_threshold(meth, obj) ⇒ Object
:nodoc:.
-
.object(obj) ⇒ Object
:nodoc:.
-
.replacing_const(sym, call_const, obj) ⇒ Object
:nodoc:.
-
.replacing_method(meth, call_method, obj) ⇒ Object
:nodoc:.
Class Method Details
.ambigious_const(sym, possibilities, obj) ⇒ Object
:nodoc:
164 165 166 167 168 169 170 171 172 |
# File 'lib/guessmethod.rb', line 164 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 |
.ambiguous_method(meth, possibilities, obj) ⇒ Object
:nodoc:
137 138 139 140 141 142 143 144 145 |
# File 'lib/guessmethod.rb', line 137 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:
174 175 176 177 178 179 |
# File 'lib/guessmethod.rb', line 174 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:
147 148 149 150 151 152 |
# File 'lib/guessmethod.rb', line 147 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 |
.object(obj) ⇒ Object
:nodoc:
128 129 130 131 132 133 134 135 |
# File 'lib/guessmethod.rb', line 128 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:
181 182 183 184 185 186 187 188 189 |
# File 'lib/guessmethod.rb', line 181 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:
154 155 156 157 158 159 160 161 162 |
# File 'lib/guessmethod.rb', line 154 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 |