@@ -48,31 +48,32 @@ def self.syntax_error?(exception)
48
48
def self . has_binding_stack? ( exception )
49
49
exception . respond_to? ( :__better_errors_bindings_stack ) && exception . __better_errors_bindings_stack . any?
50
50
end
51
-
51
+
52
52
attr_reader :filename , :line , :name , :frame_binding
53
-
53
+
54
54
def initialize ( filename , line , name , frame_binding = nil )
55
55
@filename = filename
56
56
@line = line
57
57
@name = name
58
58
@frame_binding = frame_binding
59
-
59
+
60
60
set_pretty_method_name if frame_binding
61
61
end
62
-
62
+
63
63
def application?
64
- root = BetterErrors . application_root
65
- filename . index ( root ) == 0 if root
64
+ if root = BetterErrors . application_root
65
+ filename . index ( root ) == 0 && filename . index ( "#{ root } /vendor" ) != 0
66
+ end
66
67
end
67
-
68
+
68
69
def application_path
69
70
filename [ ( BetterErrors . application_root . length +1 ) ..-1 ]
70
71
end
71
72
72
73
def gem?
73
74
Gem . path . any? { |path | filename . index ( path ) == 0 }
74
75
end
75
-
76
+
76
77
def gem_path
77
78
if path = Gem . path . detect { |path | filename . index ( path ) == 0 }
78
79
gem_name_and_version , path = filename . sub ( "#{ path } /gems/" , "" ) . split ( "/" , 2 )
@@ -88,7 +89,7 @@ def class_name
88
89
def method_name
89
90
@method_name || @name
90
91
end
91
-
92
+
92
93
def context
93
94
if gem?
94
95
:gem
@@ -98,15 +99,15 @@ def context
98
99
:dunno
99
100
end
100
101
end
101
-
102
+
102
103
def pretty_path
103
104
case context
104
105
when :application ; application_path
105
106
when :gem ; gem_path
106
107
else filename
107
108
end
108
109
end
109
-
110
+
110
111
def local_variables
111
112
return { } unless frame_binding
112
113
frame_binding . eval ( "local_variables" ) . each_with_object ( { } ) do |name , hash |
@@ -122,7 +123,7 @@ def local_variables
122
123
end
123
124
end
124
125
end
125
-
126
+
126
127
def instance_variables
127
128
return { } unless frame_binding
128
129
Hash [ visible_instance_variables . map { |x |
@@ -137,7 +138,7 @@ def visible_instance_variables
137
138
def to_s
138
139
"#{ pretty_path } :#{ line } :in `#{ name } '"
139
140
end
140
-
141
+
141
142
private
142
143
def set_pretty_method_name
143
144
return if RUBY_VERSION < "2.0.0"
0 commit comments