Class: LedgerSync::AdaptorConfiguration
- Inherits:
-
Object
- Object
- LedgerSync::AdaptorConfiguration
- Includes:
- Fingerprintable::Mixin, SimplySerializable::Mixin
- Defined in:
- lib/ledger_sync/adaptor_configuration.rb
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
Returns the value of attribute aliases.
-
#module_string ⇒ Object
Returns the value of attribute module_string.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rate_limiting_wait_in_seconds ⇒ Object
Returns the value of attribute rate_limiting_wait_in_seconds.
-
#root_key ⇒ Object
readonly
Returns the value of attribute root_key.
-
#test ⇒ Object
Returns the value of attribute test.
Instance Method Summary collapse
- #adaptor_klass ⇒ Object
- #add_alias(new_alias) ⇒ Object
- #base_module ⇒ Object
-
#initialize(root_key, module_string: nil) ⇒ AdaptorConfiguration
constructor
A new instance of AdaptorConfiguration.
-
#new(*args) ⇒ Object
Delegate #new to the adaptor class enabling faster adaptor initialization e.g.
-
#new_from_env(*args) ⇒ Object
Delegate #new_from_env to the adaptor class enabling faster adaptor initialization e.g.
- #test? ⇒ Boolean
Constructor Details
#initialize(root_key, module_string: nil) ⇒ AdaptorConfiguration
Returns a new instance of AdaptorConfiguration.
24 25 26 27 28 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 24 def initialize(root_key, module_string: nil) @root_key = root_key @aliases = [] @module_string = module_string || LedgerSync::Util::StringHelpers.camelcase(root_key) end |
Instance Attribute Details
#aliases ⇒ Object (readonly)
Returns the value of attribute aliases.
13 14 15 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 13 def aliases @aliases end |
#module_string ⇒ Object
Returns the value of attribute module_string.
8 9 10 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 8 def module_string @module_string end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 8 def name @name end |
#rate_limiting_wait_in_seconds ⇒ Object
Returns the value of attribute rate_limiting_wait_in_seconds.
8 9 10 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 8 def rate_limiting_wait_in_seconds @rate_limiting_wait_in_seconds end |
#root_key ⇒ Object (readonly)
Returns the value of attribute root_key.
13 14 15 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 13 def root_key @root_key end |
#test ⇒ Object
Returns the value of attribute test.
8 9 10 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 8 def test @test end |
Instance Method Details
#adaptor_klass ⇒ Object
30 31 32 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 30 def adaptor_klass @adaptor_klass ||= base_module::Adaptor end |
#add_alias(new_alias) ⇒ Object
34 35 36 37 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 34 def add_alias(new_alias) @aliases << new_alias LedgerSync.adaptors.add_alias(new_alias, self) end |
#base_module ⇒ Object
39 40 41 42 43 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 39 def base_module @base_module ||= begin LedgerSync::Adaptors.const_get(@module_string) end end |
#new(*args) ⇒ Object
Delegate #new to the adaptor class enabling faster adaptor initialization e.g. LedgerSync.adaptors.test.new(…)
47 48 49 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 47 def new(*args) adaptor_klass.new(*args) end |
#new_from_env(*args) ⇒ Object
Delegate #new_from_env to the adaptor class enabling faster adaptor initialization e.g. LedgerSync.adaptors.test.new_from_env(…)
53 54 55 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 53 def new_from_env(*args) adaptor_klass.new_from_env(*args) end |
#test? ⇒ Boolean
57 58 59 |
# File 'lib/ledger_sync/adaptor_configuration.rb', line 57 def test? test == true end |