peeky 0.0.48 → 0.0.49

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: b101eb2cf5f68f0a26a46579ddc1b87df3f8b2edbfefa9aa8301a8efe1b6f44a
4
- data.tar.gz: 56e16cec9351212f107137cb1efda57c0221a8ffac84945b36a51231f66536c4
3
+ metadata.gz: aff77966760d7a7c6d692018aa18baa50188c6a7f22f989c6d5dda3805803568
4
+ data.tar.gz: fcc3b1211915afe38b6fa0cfa803813ea40c54a87d03893c1d8b816ea1188244
5
5
  SHA512:
6
- metadata.gz: 8bef9b277830666604a788bdc0f1dc242b5d58c15d1c44d83a58ad559fc883d6888b1fbfde996514af27b4e90729d65a69c5b49ce81df7c79685ce89f7d953b1
7
- data.tar.gz: 8c650d21456723d845c994d117a30ca9a6dcb5dbc26bb35a12b50bf33805f4ba863f8de665b8265a0d58cf5ee1eb17f2aa035b00c3ba1044624661becc6e24c9
6
+ metadata.gz: 52b00507cf58f9723d285c0405b7e96016fe51aa52b15b4a7a0eb60e03ce02ccbb226f60d22b9d005607064c03affb4ec67acc4c961675e1afc22170f01f93d5
7
+ data.tar.gz: 86804ade54bca766936cdddab08b04ca6c22a1a05e1845efa056a7538b4d44018a6933ea494e4c09406c31ce7ac6c7764928f7c13fdb212a568b2dce25959e00
@@ -252,21 +252,21 @@ module Peeky
252
252
  def ruby_class_methods
253
253
  @ruby_class_methods ||= ruby_class_method_names.map { |method_name| instance.class.method(method_name) }
254
254
  rescue StandardError => e
255
- # puts 'ruby_class_methods'
255
+ puts 'ruby_class_methods'
256
256
  puts e
257
257
  end
258
258
 
259
259
  def ruby_private_methods
260
260
  @ruby_private_methods ||= ruby_private_method_names.map { |method_name| instance.method(method_name) }
261
261
  rescue StandardError => e
262
- # puts 'ruby_private_methods'
262
+ puts 'ruby_private_methods'
263
263
  puts e
264
264
  end
265
265
 
266
266
  def ruby_instance_methods
267
267
  @ruby_instance_methods ||= ruby_instance_method_names.map { |method_name| instance.method(method_name) }
268
268
  rescue StandardError => e
269
- # puts 'ruby_instance_methods'
269
+ puts 'ruby_instance_methods'
270
270
  puts e
271
271
  end
272
272
 
@@ -94,15 +94,22 @@ module Peeky
94
94
  return if minimalist_method.end_with?('=')
95
95
  return unless optional?
96
96
 
97
+ # TODO: maybe I can use this technique instead and just read the source code
98
+ # file, line = @focal_method.source_location
99
+
97
100
  tracer.enable do
101
+ # puts grab_source
98
102
  # TODO: minimalist method should be able to handle class methods
99
103
  @target_instance.instance_eval(minimalist_method) if @implementation_type == :method
100
104
  @target_instance.class.instance_eval(minimalist_method) if @implementation_type == :class_method
101
- rescue StandardError => e
105
+ rescue StandardError, LoadError # => e
102
106
  # just print the error for now, we are only attempting to capture the
103
107
  # first call, any errors inside the call cannot be dealt with and should
104
108
  # not be re-raised
105
- puts e.message
109
+ # red full stop
110
+ print "\e[31m.\e[0m"
111
+ # puts minimalist_method
112
+ # puts e.message
106
113
  end
107
114
  end
108
115
 
@@ -159,5 +166,10 @@ module Peeky
159
166
  def writable?
160
167
  @implementation_type == :attr_writer
161
168
  end
169
+
170
+ def grab_source(limit = 10)
171
+ file, line = @focal_method.source_location
172
+ File.read(file).lines[line - 1, limit] if file && line
173
+ end
162
174
  end
163
175
  end
@@ -34,7 +34,7 @@ module Peeky
34
34
  cloned.instance_eval(code)
35
35
  begin
36
36
  current_value = cloned.send(method_name)
37
- rescue StandardError #=> exception
37
+ rescue StandardError, LoadError
38
38
  current_value = nil
39
39
  end
40
40
 
data/lib/peeky/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Peeky
4
- VERSION = '0.0.48'
4
+ VERSION = '0.0.49'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peeky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.48
4
+ version: 0.0.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-04 00:00:00.000000000 Z
11
+ date: 2022-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  requirements: []
102
- rubygems_version: 3.2.7
102
+ rubygems_version: 3.2.33
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Take a peek into your ruby classes and extract useful meta data