sus 0.19.0 → 0.20.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: cfeea4d70fa47d75bd19bf498b1172dc61124f1d3cc517800c70ae087342c14c
4
- data.tar.gz: e1b2279e1168e680fd068af67f6d44f376cfe1c7c74728b7506f661dafdb1db9
3
+ metadata.gz: 32d3a31b1ef9a5f80523b6d3bbe34d8fe1312fbee9f48b96eff16ee0c7755b46
4
+ data.tar.gz: 7fe132541184eb203cd93f1bb5f94288c473a70d0329b1a351d7bd70be382e41
5
5
  SHA512:
6
- metadata.gz: b09f509fccb65717ae48c657ecb0a2e530761276614d3dc1f9f49fb131caeaf074cbd4bfef1458e029b38347b3aa95a3eb93f7cf6fd7ceeb6e0a23914bbaca66
7
- data.tar.gz: ac457785b0c6753fd85107c08a37ae735ba1b4e9716aa3b167e51a2de0e5d27dea4a93062c730af5fb36a4a5279472cef71c20431d5602778d04040c6c420d83
6
+ metadata.gz: 451fa9e5cc095f4af36347f0fc5f55ffbd74ce1b03efa6985cacbcdd2aa469ec577aadc8c6fe4d197e7f323bdd7ae18ca318c2cc1861568abe2b1230525a078f
7
+ data.tar.gz: 6d9ae7c5173b87ac726f3e61b13ae3ca199adf73cb86bba9f9e2326cacc064ea395a692288d97a3898fb7ff7500ad8581303a8d3331813fd8bfd04c3665a0da6
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/sus/identity.rb CHANGED
@@ -95,7 +95,7 @@ module Sus
95
95
  end
96
96
  else
97
97
  # In theory this should be a bit faster:
98
- Thread.each_caller_location do |location|
98
+ each_caller_location do |location|
99
99
  if location.path == @path
100
100
  return self.with_line(location.lineno)
101
101
  end
@@ -107,6 +107,16 @@ module Sus
107
107
 
108
108
  protected
109
109
 
110
+ if Thread.respond_to?(:each_caller_location)
111
+ def each_caller_location(&block)
112
+ Thread.each_caller_location(&block)
113
+ end
114
+ else
115
+ def each_caller_location(&block)
116
+ caller_locations(1).each(&block)
117
+ end
118
+ end
119
+
110
120
  def append_unique_key(key, unique = @unique)
111
121
  if @parent
112
122
  @parent.append_unique_key(key)
data/lib/sus/it.rb CHANGED
@@ -7,11 +7,11 @@ require_relative 'context'
7
7
 
8
8
  module Sus
9
9
  module It
10
- def self.build(parent, description = nil, &block)
10
+ def self.build(parent, description = nil, unique: true, &block)
11
11
  base = Class.new(parent)
12
12
  base.extend(It)
13
13
  base.description = description
14
- base.identity = Identity.nested(parent.identity, base.description)
14
+ base.identity = Identity.nested(parent.identity, base.description, unique: unique)
15
15
 
16
16
  if block_given?
17
17
  base.define_method(:call, &block)
data/lib/sus/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2021-2022, by Samuel Williams.
5
5
 
6
6
  module Sus
7
- VERSION = "0.19.0"
7
+ VERSION = "0.20.0"
8
8
  end
data/lib/sus/with.rb CHANGED
@@ -44,10 +44,10 @@ module Sus
44
44
  end
45
45
 
46
46
  module Context
47
- def with(subject = nil, **variables, &block)
47
+ def with(subject = nil, unique: true, **variables, &block)
48
48
  subject ||= variables.inspect
49
49
 
50
- add With.build(self, subject, variables, &block)
50
+ add With.build(self, subject, variables, unique: unique, &block)
51
51
  end
52
52
  end
53
53
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -38,7 +38,7 @@ cert_chain:
38
38
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
39
39
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
40
40
  -----END CERTIFICATE-----
41
- date: 2023-02-20 00:00:00.000000000 Z
41
+ date: 2023-02-24 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: bake-test
metadata.gz.sig CHANGED
Binary file