Skip to content

Commit ad6d30a

Browse files
committed
Alias ruby gem loadable_path to to_path
The sqlite3-ruby recently published an improvement to make it easier and more flexible to load extensions: sparklemotion/sqlite3-ruby#586 Ruby modules for SQLite extensions should implement the interface: interface _ExtensionSpecifier def to_path: () → String end A complementary change in Rails takes advantage of this interface to integrate the primary configuration file with the new sqlite3-ruby interface for extension loading: rails/rails#53827 The gem template provided here already has a similar method: def loadable_path The change proposed here is to modify the gem template to provide an alias to loadable_path as to_path.o # example SqliteVec.to_path # => returns same result as loadable_path As a result of this change, Ruby gems published with this tool will conform to the new interface supported in sqlite3-ruby and Rails.
1 parent 6ea6486 commit ad6d30a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/gem.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,14 @@ module {module_name}
297297
def self.loadable_path
298298
File.expand_path('{entrypoint}', File.dirname(__FILE__))
299299
end
300+
300301
def self.load(db)
301302
db.load_extension(self.loadable_path)
302303
end
304+
305+
class << self
306+
alias_method :to_path, :loadable_path
307+
end
303308
end
304309
305310
"#

0 commit comments

Comments
 (0)