stable 1.3.0 → 1.4.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stable/spec.rb +3 -1
  3. data/lib/stable.rb +18 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 632d329e437a0d82fed98a7fd06f9f93c160363e961ea2c835bcc40cc1330066
4
- data.tar.gz: e301162819f6e056594cc07c600c4c678d91143e371b848367be9e9abaaceaca
3
+ metadata.gz: c0ceeb4f1149e27df669ab25482efd557e1235a1e55014322ada67ce1639c34f
4
+ data.tar.gz: 2e181545071d2d064cea2da6ebe1c587e113af4751333a20af2260b413ce602e
5
5
  SHA512:
6
- metadata.gz: '036778caa60876817ab53b71c2e5c2fbedd4105e9084c1bc6a45b6c688a6172f60a0b3434cc732806426131259848ed345de71d519011263692a907282f9a02a'
7
- data.tar.gz: f427b87ee21f105729862a77e51d06814c90a931f18ced149a6b22cfff42cce643997252e0fdc42f00b9ec6a1db7e478c635db9f45bb7b49076b77443c650804
6
+ metadata.gz: 79c8dd17e53a71b7b4ee2a045182c08aa8c85a08f5aca4374aca987ef7ab740e134776fd1b0f396462e5e9890713639c7581b332eab507ca295c71c2854e3985
7
+ data.tar.gz: 0ecb7350223103b539f01a260219549b75c9f0602abb7369ac57cd92aba6f76cdc060371d7d0ef0f0037fdc8552501ffd54db5758626d5a8b2b55e1b0bf768e2
data/lib/stable/spec.rb CHANGED
@@ -47,7 +47,9 @@ module Stable
47
47
  end
48
48
 
49
49
  def to_s
50
- desc = "#{uuid}/#{signature}"
50
+ short_uuid = uuid.split('-').last
51
+ short_sig = signature[0..6]
52
+ desc = "#{short_uuid}/#{short_sig}"
51
53
  call = "#{class_name}##{method_name}(#{args.join(', ')})"
52
54
 
53
55
  case status
data/lib/stable.rb CHANGED
@@ -24,7 +24,24 @@ module Stable
24
24
  @storage || raise("Stable.storage must be set to an IO-like object")
25
25
  end
26
26
 
27
- def record(klass, method_name)
27
+ # this method is a block-based way to enable and disable recording of
28
+ # specs. It ensures that recording is turned on for the duration of the
29
+ # block and is automatically turned off afterward, even if an error occurs.
30
+ #
31
+ # example:
32
+ #
33
+ # Stable.recording do
34
+ # # code in here will be recorded
35
+ # end
36
+ #
37
+ def recording
38
+ enable!
39
+ yield if block_given?
40
+ ensure
41
+ disable!
42
+ end
43
+
44
+ def watch(klass, method_name)
28
45
  original_method = klass.instance_method(method_name)
29
46
  wrapper_module = Module.new do
30
47
  define_method(method_name) do |*args, &block|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Lunt