Class: Grumlin::Config
- Inherits:
-
Object
- Object
- Grumlin::Config
- Defined in:
- lib/grumlin/config.rb
Defined Under Namespace
Classes: ConfigurationError, UnknownProviderError
Constant Summary collapse
- SUPPORTED_PROVIDERS =
[:neptune, :tinkergraph].freeze
- DEFAULT_MIDDLEWARES =
Grumlin::Middlewares::Builder.new do |b| b.use Grumlin::Middlewares::SerializeToSteps b.use Grumlin::Middlewares::ApplyShortcuts b.use Grumlin::Middlewares::SerializeToBytecode b.use Grumlin::Middlewares::BuildQuery b.use Grumlin::Middlewares::CastResults b.use Grumlin::Middlewares::RunQuery end
Instance Attribute Summary collapse
-
#client_concurrency ⇒ Object
Returns the value of attribute client_concurrency.
-
#client_factory ⇒ Object
Returns the value of attribute client_factory.
-
#pool_size ⇒ Object
Returns the value of attribute pool_size.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #middlewares {|@middlewares| ... } ⇒ Object
- #validate! ⇒ Object
Constructor Details
Instance Attribute Details
#client_concurrency ⇒ Object
Returns the value of attribute client_concurrency.
4 5 6 |
# File 'lib/grumlin/config.rb', line 4 def client_concurrency @client_concurrency end |
#client_factory ⇒ Object
Returns the value of attribute client_factory.
4 5 6 |
# File 'lib/grumlin/config.rb', line 4 def client_factory @client_factory end |
#pool_size ⇒ Object
Returns the value of attribute pool_size.
4 5 6 |
# File 'lib/grumlin/config.rb', line 4 def pool_size @pool_size end |
#provider ⇒ Object
Returns the value of attribute provider.
4 5 6 |
# File 'lib/grumlin/config.rb', line 4 def provider @provider end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/grumlin/config.rb', line 4 def url @url end |
Instance Method Details
#middlewares {|@middlewares| ... } ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/grumlin/config.rb', line 28 def middlewares @middlewares ||= Grumlin::Middlewares::Builder.new do |b| b.use DEFAULT_MIDDLEWARES end yield(@middlewares) if block_given? @middlewares end |
#validate! ⇒ Object
36 37 38 39 40 |
# File 'lib/grumlin/config.rb', line 36 def validate! return if SUPPORTED_PROVIDERS.include?(provider.to_sym) raise UnknownProviderError, "provider '#{provider}' is unknown. Supported providers: #{SUPPORTED_PROVIDERS}" end |