pry-auto_benching.rb 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b240184c50fc0db87a2b924a88a36fea5567100cbed5b2eb3c851d5321afb9f
4
- data.tar.gz: 35df0930279f3437748ce57d0f19189f0344e6051268c8d49d25076985ca5496
3
+ metadata.gz: ee29d04eb0fa35fcebea243a1d411d9e9163fa50d0055ff60546677558e7f249
4
+ data.tar.gz: 429e451131c12ce282de19a9275a57e8d4ad580565fd441ce872b721e4dbb0e9
5
5
  SHA512:
6
- metadata.gz: 5380fb68936080bacf6b846a9b2c1ea035bc8caca77091c1d7144f665a677f60ca5d18a066ff719d3d103366b7f1150eb06e660917543390c39193e0cb32bdd4
7
- data.tar.gz: 9a96ad7491db7347ea855300725cef7b704bc99b8745e9f721553cd7a68b44a3ea1612b72e6cefd00b1c37b0ba5ee86aa243e6cc0cc3113961d663b99f0dd5cb
6
+ metadata.gz: 2011eca5212e3cf1c072ec497660957987c45c9b1d4f3abffccd7f6b3db9fc941b4be47ce67fae6339d3380ba540bf6e9de228953ce7e426c8a95424b996fb8d
7
+ data.tar.gz: 57e55c6f5f972ead96676bdbeceb3186898886287186bcba36abb61631a80cbc2560a83cface0a85f1ad1e7e41aaa54fc82eda5e18e923eebd24992eb9032de0
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ ![s1](./s1.png)
2
+
1
3
  # pry-auto_benching.rb
2
4
 
3
5
  pry-auto_benching.rb automatically benchmarks input entered into Pry.
@@ -12,8 +14,8 @@ Pry.configure do |config|
12
14
  # Start benchmarking as soon as Pry starts? default is true.
13
15
  config.auto_benching.enabled = false
14
16
 
15
- # Benchmark Pry commands? Default is false
16
- config.auto_benching.benchmark_commands = true
17
+ # Benchmark Pry commands? Default is true
18
+ config.auto_benching.benchmark_commands = false
17
19
 
18
20
  # The type of clock to use, default is Process::CLOCK_MONOTONIC.
19
21
  # See https://www.rubydoc.info/stdlib/core/Process:clock_gettime
@@ -24,7 +26,7 @@ Pry.configure do |config|
24
26
  config.auto_benching.target_display = ':prompt | :output'
25
27
 
26
28
  # Benchmark results are printed depending on the return value
27
- # of this lambda, by default results are printed if duration >= 0.1s
29
+ # of this lambda, by default results are always printed.
28
30
  config.auto_benching.speak_if = ->(pry, duration) {
29
31
  duration > 0.5
30
32
  }
@@ -1,5 +1,5 @@
1
1
  class Pry
2
2
  module AutoBenching
3
- VERSION = "1.2.0"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -22,7 +22,7 @@ module Pry::AutoBenching
22
22
 
23
23
  AFTER_EVAL = ->(input, pry) do
24
24
  clock_type = pry.config.auto_benching.clock_type
25
- duration = (sprintf "%.2f", Process.clock_gettime(clock_type) - MEMORY[pry.hash][-1]).to_f
25
+ duration = (sprintf "%.2f", Process.clock_gettime(clock_type) - MEMORY[pry.hash].pop).to_f
26
26
  if input.nil? # Pry command
27
27
  if pry.config.auto_benching.benchmark_commands and
28
28
  pry.config.auto_benching.speak_if.call(pry, duration)
@@ -36,7 +36,6 @@ module Pry::AutoBenching
36
36
  end
37
37
  end
38
38
  pry.config.prompt_name = 'pry' if pry.config.auto_benching.target_display != :prompt
39
- MEMORY[pry.hash].clear
40
39
  end
41
40
 
42
41
  BEFORE_SESSION = ->(_,_, pry) do
@@ -96,8 +95,8 @@ Pry.configure do |config|
96
95
  target_display: :prompt,
97
96
  prompt_color: :green,
98
97
  clock_type: Process::CLOCK_MONOTONIC,
99
- benchmark_commands: false,
100
- speak_if: ->(pry, duration) { duration >= 0.1 },
98
+ benchmark_commands: true,
99
+ speak_if: ->(pry, duration) { true },
101
100
  speaker: ->(pry, duration) {
102
101
  pry.pager.page format("%{AutoBenchingSays} %{Duration}s", {
103
102
  :AutoBenchingSays => pry.color ?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-auto_benching.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Gleeson