fixture_kit 0.12.0 → 0.14.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: 2c9915548250aae8114a3a630aea4b15f72d917af609b30a0124deb2e113a89f
4
- data.tar.gz: bf8f98353a02ecb125bbb197e26da4c573ad29864cdbe1ebfa39720a9a39f2b9
3
+ metadata.gz: 1ec46a033864696a48fe4a196744b61dd142aeabee84a68f65554ccf698d4e72
4
+ data.tar.gz: 5e41645bf7246d12f8a0bbecb4bbad7bcb6f1f2dddab685fc6c32b459c2a3550
5
5
  SHA512:
6
- metadata.gz: 85b05a575c716a32ccca6ada6bb90b7cc1902d1ec4d2133675c6506f703d2985a7feafe3e9493fee0fe1abf8267a0ac852228e7365be511552435a44ebad777d
7
- data.tar.gz: da4a70d39f1a819b8be241014640950a0f3c614c2435348c5c8d41829ffa47519a3765490cf0e391ea27f8c5668f383546bd6344dc1fa4e983434b9a89812202
6
+ metadata.gz: fd821fd991c0ded4d4d10f963ece4cde8740c55c88fce238cf0033adbb791e2e64b50b3257c82a6fecd93e8810cd068e49329361b26661dd4072c1287c618ae3
7
+ data.tar.gz: 416bed6e4889c63a5a860c55b45e3f525499682cd5367e712b365555361fd36bd561c3e0cd02259d32f969c9877a50d0f01c570f0159af68a01334f526968f2d
@@ -10,6 +10,10 @@ module FixtureKit
10
10
  @extends = extends
11
11
  end
12
12
 
13
+ def path
14
+ @definition.source_location.first
15
+ end
16
+
13
17
  def evaluate(context, parent: nil)
14
18
  context.singleton_class.prepend(mixin(parent))
15
19
  context.instance_exec(&@definition)
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FixtureKit
4
+ class Event
5
+ attr_reader :fixture
6
+
7
+ def initialize(fixture)
8
+ @fixture = fixture
9
+ end
10
+
11
+ def identifier
12
+ fixture.cache.identifier
13
+ end
14
+
15
+ def path
16
+ fixture.definition.path
17
+ end
18
+ end
19
+ end
@@ -46,10 +46,10 @@ module FixtureKit
46
46
  !identifier.is_a?(String)
47
47
  end
48
48
 
49
- def emit(event)
50
- cache_identifier = @cache.identifier
49
+ def emit(event_name)
50
+ fixture_event = Event.new(self)
51
51
  unless block_given?
52
- configuration.callbacks.run(event, cache_identifier)
52
+ configuration.callbacks.run(event_name, fixture_event)
53
53
  return
54
54
  end
55
55
 
@@ -57,7 +57,7 @@ module FixtureKit
57
57
  elapsed = Benchmark.realtime do
58
58
  value = yield
59
59
  end
60
- configuration.callbacks.run(event, cache_identifier, elapsed)
60
+ configuration.callbacks.run(event_name, fixture_event, elapsed)
61
61
  value
62
62
  end
63
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FixtureKit
4
- VERSION = "0.12.0"
4
+ VERSION = "0.14.0"
5
5
  end
data/lib/fixture_kit.rb CHANGED
@@ -15,6 +15,7 @@ module FixtureKit
15
15
  autoload :Callbacks, File.expand_path("fixture_kit/callbacks", __dir__)
16
16
  autoload :ConfigurationHelper, File.expand_path("fixture_kit/configuration_helper", __dir__)
17
17
  autoload :Singleton, File.expand_path("fixture_kit/singleton", __dir__)
18
+ autoload :Event, File.expand_path("fixture_kit/event", __dir__)
18
19
  autoload :Fixture, File.expand_path("fixture_kit/fixture", __dir__)
19
20
  autoload :Definition, File.expand_path("fixture_kit/definition", __dir__)
20
21
  autoload :Registry, File.expand_path("fixture_kit/registry", __dir__)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixture_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ngan Pham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-05 00:00:00.000000000 Z
11
+ date: 2026-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -163,6 +163,7 @@ files:
163
163
  - lib/fixture_kit/configuration.rb
164
164
  - lib/fixture_kit/configuration_helper.rb
165
165
  - lib/fixture_kit/definition.rb
166
+ - lib/fixture_kit/event.rb
166
167
  - lib/fixture_kit/file_cache.rb
167
168
  - lib/fixture_kit/fixture.rb
168
169
  - lib/fixture_kit/memory_cache.rb