Module: Pendragon
- Defined in:
- lib/pendragon.rb,
lib/pendragon/errors.rb,
lib/pendragon/linear.rb,
lib/pendragon/router.rb,
lib/pendragon/realism.rb,
lib/pendragon/version.rb,
lib/pendragon/constants.rb
Defined Under Namespace
Modules: Errors Classes: Linear, Realism, Router
Constant Summary collapse
- DEFAULT_TYPE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Type to use if no type is given.
:realism
- VERSION =
'1.0.0'
Class Method Summary collapse
-
.[](name) ⇒ Class, #new
Returns router by given name.
-
.new(type: DEFAULT_TYPE) { ... } ⇒ Object
Creates a new router.
Class Method Details
.[](name) ⇒ Class, #new
Returns router by given name.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/pendragon.rb', line 40 def self.[](name) @types.fetch(normalized = normalize_type(name)) do @mutex.synchronize do error = try_require "pendragon/#{normalized}" @types.fetch(normalized) do fail ArgumentError, "unsupported type %p #{ " (#{error.})" if error }" % name end end end end |
.new(type: DEFAULT_TYPE) { ... } ⇒ Object
Creates a new router.
24 25 26 27 |
# File 'lib/pendragon.rb', line 24 def self.new(type: DEFAULT_TYPE, &block) type ||= DEFAULT_TYPE self[type].new(&block) end |