Skip to content

Commit a9779b0

Browse files
committed
Only require pstore if needed
1 parent 1fdef03 commit a9779b0

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if RUBY_VERSION >= '3.4'
2929
end
3030

3131
if RUBY_VERSION >= '4.0'
32-
gem 'pstore'
3332
gem 'logger'
3433
gem 'ostruct'
34+
gem 'pstore'
3535
end

lib/webmachine/trace/pstore_trace_store.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
require 'pstore'
2-
31
module Webmachine
42
module Trace
5-
# Implements a trace storage using PStore from Ruby's standard
6-
# library. To use this trace store, specify the :pstore engine
7-
# and a path where it can store traces:
3+
# Implements a trace storage using the pstore gem. To use this trace store,
4+
# add `pstore` to your Gemfile and specify the :pstore engine and a path
5+
# where it can store traces:
86
# @example
97
# Webmachine::Trace.trace_store = :pstore, "/tmp/webmachine.trace"
108
class PStoreTraceStore
119
# @api private
1210
# @param [String] path where to store traces in a PStore
1311
def initialize(path)
12+
require 'pstore' # JIT load of the pstore gem. Avoid requiring the dependency when this class is not used.
1413
@pstore = PStore.new(path)
1514
end
1615

0 commit comments

Comments
 (0)