Module: IRuby::SessionAdapter
- Defined in:
- lib/iruby/session_adapter.rb,
lib/iruby/session_adapter/test_adapter.rb,
lib/iruby/session_adapter/cztop_adapter.rb,
lib/iruby/session_adapter/ffirzmq_adapter.rb more...
Defined Under Namespace
Classes: BaseAdapter, CztopAdapter, FfirzmqAdapter, TestAdapter
Class Method Summary collapse
Class Method Details
permalink .select_adapter_class(name = nil) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/iruby/session_adapter.rb', line 45 def self.select_adapter_class(name=nil) classes = { 'ffi-rzmq' => SessionAdapter::FfirzmqAdapter, 'cztop' => SessionAdapter::CztopAdapter, 'test' => SessionAdapter::TestAdapter, } if (name ||= ENV.fetch('IRUBY_SESSION_ADAPTER', nil)) cls = classes[name] unless cls.available? if ENV['IRUBY_SESSION_ADAPTER'] raise SessionAdapterNotFound, "Session adapter `#{name}` from IRUBY_SESSION_ADAPTER is unavailable" else raise SessionAdapterNotFound, "Session adapter `#{name}` is unavailable" end end if name == 'cztop' warn "WARNING: cztop was deprecated and will be removed; Use ffi-rzmq, instead." end return cls end classes.each_value do |cls| return cls if cls.available? end raise SessionAdapterNotFound, "No session adapter is available" end |