Module: RPath
- Defined in:
- lib/rpath.rb,
lib/rpath/util.rb,
lib/rpath/adapter.rb,
lib/rpath/version.rb,
lib/rpath/adapters.rb,
lib/rpath/registry.rb,
lib/rpath/expressions.rb,
lib/rpath/adapters/oga.rb,
lib/rpath/adapters/rexml.rb,
lib/rpath/adapters/nokogiri.rb,
lib/rpath/adapters/filesystem.rb
Defined Under Namespace
Modules: Adapters Classes: Adapter, Adjacent, At, Attribute, Content, Expression, Named, Root, VertexArrayExpression, VertexExpression, Where
Constant Summary collapse
- VERSION =
'1.1.0'
Class Method Summary collapse
-
.use(adapter, id = nil) ⇒ void
(also: register)
Registers an adapter.
Class Method Details
.use(adapter, id = nil) ⇒ void Also known as: register
This method returns an undefined value.
Registers an adapter. Once an adapter is registered, RPath calls its RPath::Adapter#adapts? when trying to infer the adapter for an evaluation, and its id may be given to #RPath.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rpath.rb', line 33 def use(adapter, id = nil) if adapter.is_a?(Symbol) class_names = [Util.camelcase(adapter.to_s), adapter.to_s.upcase] class_ = Util.first_defined_const(RPath::Adapters, *class_names) unless class_ raise "No adapter in RPath::Adapters with class name in #{class_names}" end adapter = class_.new end Registry.register adapter, id end |