eturem 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 767768a9b608e0cf83064badb5717aecec8d95d729cd6f578944e69240410145
4
- data.tar.gz: 91f5d7e50048c588b5ec8ee922ee7db379173b64e731382f0f4e14f07c1b81ec
3
+ metadata.gz: a8a5047f8abece1142eb4b66a8f82a0dc4cb0beec433d6927754282f2921b51a
4
+ data.tar.gz: 49fbfaa759957bc31b949dbdf2cb82eab9b27359089a1f183b0bd7831ced62c5
5
5
  SHA512:
6
- metadata.gz: 288c49a8a1093d696fcc897f076a21c800640ee9b6229a48325f68ed769acf366fcdb4c085b09ebb2f0f3a1386f9f95d2d417f2f99a96733c50bb238d030b834
7
- data.tar.gz: c658ff6c2fa82566e5052b515306b78cd096bca286d2a41875f2ef0aec1271dcb7a0f44962e7bb51c8d466485f37d4d86a5f79a840d471569b31dbf4689a16d9
6
+ metadata.gz: e5cace0860ff7e4390a2fcdc824933a0370290dc3e905166908c868984a823a31134ee8a5bf2d6e7feb5694ef763234e28b8c91c1a4c5bdcbfaf3cf3e97bfe2c
7
+ data.tar.gz: 428ec5fbea0f432c6df6224127448a2db87e8fbf15a5b8f0f2cbebdfe210763661acd96d7048a65ec27358966f85b3735b3b2b380b8f650348f964cce348d902
@@ -36,6 +36,23 @@ if enable
36
36
  Eturem::Base.before_line_num = before_line_num
37
37
  Eturem::Base.after_line_num = after_line_num
38
38
 
39
+ if File.exist?($PROGRAM_NAME)
40
+ program_file = File.open($PROGRAM_NAME, "rb")
41
+ script = program_file.read
42
+ if script.match(/^__END__\R/)
43
+ program_file.pos = Regexp.last_match.end(0)
44
+ encoding = "utf-8"
45
+ if script.match(/\A(?:#!.*\R)?#.*coding *[:=] *(?<encoding>[^\s:]+)/)
46
+ encoding = Regexp.last_match(:encoding)
47
+ end
48
+ program_file.set_encoding(encoding)
49
+ Object.const_set(:DATA, program_file)
50
+ program_file
51
+ else
52
+ program_file.close
53
+ end
54
+ end
55
+
39
56
  eturem_path = File.expand_path("..", __FILE__)
40
57
  last_binding = nil
41
58
  tracepoint = TracePoint.trace(:raise) do |tp|
@@ -115,12 +115,11 @@ module Eturem
115
115
 
116
116
 
117
117
  def eturem_prepare
118
- this_filepath = File.expand_path(__FILE__)
119
- @eturem_backtrace_locations = self.backtrace_locations || []
120
- index = @eturem_backtrace_locations.index do |location|
121
- File.expand_path(location.path) == this_filepath
118
+ this_dirpath = File.dirname(File.expand_path(__FILE__))
119
+ @eturem_backtrace_locations = (self.backtrace_locations || []).reject do |location|
120
+ File.expand_path(location.path).start_with?(this_dirpath) ||
121
+ location.path.end_with?("/rubygems/core_ext/kernel_require.rb")
122
122
  end
123
- @eturem_backtrace_locations = @eturem_backtrace_locations[0...index] if index
124
123
 
125
124
  program_filepath = File.expand_path(Eturem.program_name)
126
125
  @eturem_backtrace_locations.each do |location|
@@ -266,7 +265,7 @@ module Eturem
266
265
 
267
266
  def eturem_prepare()
268
267
  @eturem_corrections = self.respond_to?(:corrections) ? self.corrections : []
269
- @eturem_corrections += Object.constants.select do |const|
268
+ @eturem_corrections += Object.constants.map(&:to_s).select do |const|
270
269
  const.casecmp?(self.name)
271
270
  end
272
271
  @eturem_corrections.uniq!
@@ -1,3 +1,3 @@
1
1
  module Eturem
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eturem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nodai2hITC
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-22 00:00:00.000000000 Z
11
+ date: 2020-07-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Easy To Understand Ruby Error Message.
14
14
  email: