模块 ErrorHighlight::CoreExt
常量
- SKIP_TO_S_FOR_SUPER_LOOKUP
这是一个标记,让“DidYouMean::Correctable#original_message”跳过以下 `to_s` 方法定义。请参阅 github.com/ruby/did_you_mean/pull/152
公共实例方法
detailed_message(highlight: false, error_highlight: true, **) 点击切换源代码
调用超类方法
# File lib/error_highlight/core_ext.rb, line 12 def detailed_message(highlight: false, error_highlight: true, **) return super unless error_highlight snippet = generate_snippet if highlight snippet = snippet.gsub(/.+/) { "\e[1m" + $& + "\e[m" } end super + snippet end
to_s() 点击切换源代码
调用超类方法
# File lib/error_highlight/core_ext.rb, line 27 def to_s msg = super snippet = generate_snippet if snippet != "" && !msg.include?(snippet) msg + snippet else msg end end
私有实例方法
generate_snippet() 点击切换源代码
# File lib/error_highlight/core_ext.rb, line 5 def generate_snippet spot = ErrorHighlight.spot(self) return "" unless spot return ErrorHighlight.formatter.message_for(spot) end