Class: Neo4j::Driver::Loader
- Inherits:
-
Object
- Object
- Neo4j::Driver::Loader
- Defined in:
- lib/neo4j-ruby-driver_loader.rb
Class Method Summary collapse
- .jruby? ⇒ Boolean
-
.load(impl) {|loader| ... } ⇒ Object
__dir__resolves to: dev: lib/shared → shared_root = lib/shared installed gem: lib → shared_root = lib (the impl dir is merged in by the staged build, so impl_root below is missing and the conditional push is skipped). - .mri? ⇒ Boolean
Class Method Details
.jruby? ⇒ Boolean
41 |
# File 'lib/neo4j-ruby-driver_loader.rb', line 41 def jruby? = @impl == :jruby |
.load(impl) {|loader| ... } ⇒ Object
__dir__ resolves to:
dev: lib/shared → shared_root = lib/shared
installed gem: lib → shared_root = lib (the impl dir is
merged in by the staged build, so
impl_root below is missing and the
conditional push is skipped)
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/neo4j-ruby-driver_loader.rb', line 19 def load(impl) @impl = impl shared_root = File.(__dir__) impl_root = File.("../#{impl}", shared_root) loader = Zeitwerk::Loader.new loader.tag = 'neo4j-ruby-driver' loader.inflector = Zeitwerk::GemInflector.new(File.('neo4j/driver', __dir__)) loader.inflector.inflect('packstream' => 'PackStream', 'uuid' => 'UUID') loader.push_dir(shared_root) loader.push_dir(impl_root) if File.directory?(impl_root) yield loader if block_given? # ignore the Bundler.require-friendly entry files (neo4j-ruby-driver.rb, neo4j-ruby-driver_loader.rb, # neo4j_ruby_driver.rb) since Zeitwerk would otherwise try to # autoload them as constants with the wrong names. loader.ignore(File.(__FILE__)) loader.ignore(File.('neo4j-ruby-driver.rb', __dir__)) loader.ignore(File.('neo4j_ruby_driver.rb', __dir__)) loader.setup loader.eager_load end |
.mri? ⇒ Boolean
43 |
# File 'lib/neo4j-ruby-driver_loader.rb', line 43 def mri? = @impl == :mri |