Class: EventQ::SerializationProviders::Manager
- Inherits:
-
Object
- Object
- EventQ::SerializationProviders::Manager
- Defined in:
- lib/eventq_base/serialization_providers.rb
Instance Method Summary collapse
- #get_provider(provider_type) ⇒ Object
-
#initialize ⇒ Manager
constructor
A new instance of Manager.
Constructor Details
#initialize ⇒ Manager
Returns a new instance of Manager.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/eventq_base/serialization_providers.rb', line 16 def initialize @providers = {} if RUBY_PLATFORM =~ /java/ @providers[OJ_PROVIDER] = EventQ::SerializationProviders::JRuby::OjSerializationProvider else @providers[OJ_PROVIDER] = EventQ::SerializationProviders::OjSerializationProvider end @providers[JSON_PROVIDER] = EventQ::SerializationProviders::JsonSerializationProvider @providers[BINARY_PROVIDER] = EventQ::SerializationProviders::BinarySerializationProvider end |
Instance Method Details
#get_provider(provider_type) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/eventq_base/serialization_providers.rb', line 27 def get_provider(provider_type) provider = @providers[provider_type] if provider.nil? raise "Invalid provider type specified: #{provider_type}" end return provider.new end |