diff --git a/lib/pg.rb b/lib/pg.rb index 73f2f894c..557f81728 100644 --- a/lib/pg.rb +++ b/lib/pg.rb @@ -21,6 +21,7 @@ module PG POSTGRESQL_LIB_PATH = false end end + POSTGRESQL_LIB_PATH.freeze add_dll_path = proc do |path, &block| if RUBY_PLATFORM =~/(mswin|mingw)/i && path diff --git a/lib/pg/version.rb b/lib/pg/version.rb index 579dbe2b8..d37ddd956 100644 --- a/lib/pg/version.rb +++ b/lib/pg/version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module PG # Library version VERSION = '1.6.1' diff --git a/spec/pg_spec.rb b/spec/pg_spec.rb index dc7b3e2b4..b24d3c1bf 100644 --- a/spec/pg_spec.rb +++ b/spec/pg_spec.rb @@ -57,4 +57,14 @@ expect( bres ).to eq( 55 ) end + + it "should provide constants in a Ractor", :ractor do + vals = Ractor.new(@conninfo) do |conninfo| + [PG.library_version, PG.version_string, PG.threadsafe?, PG::VERSION, PG::POSTGRESQL_LIB_PATH] + end.value + + expect( vals ).to eq( + [PG.library_version, PG.version_string, PG.threadsafe?, PG::VERSION, PG::POSTGRESQL_LIB_PATH] + ) + end end