Class: LedgerSync::LedgerConfiguration
- Inherits:
-
Object
- Object
- LedgerSync::LedgerConfiguration
- Includes:
- Fingerprintable::Mixin, SimplySerializable::Mixin
- Defined in:
- lib/ledger_sync/ledger_configuration.rb
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
Returns the value of attribute aliases.
-
#base_module ⇒ Object
readonly
Returns the value of attribute base_module.
-
#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.
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
-
#test ⇒ Object
Returns the value of attribute test.
Instance Method Summary collapse
- #add_alias(new_alias) ⇒ Object
- #client_class ⇒ Object
- #client_path ⇒ Object
-
#initialize(root_key, args = {}) ⇒ LedgerConfiguration
constructor
A new instance of LedgerConfiguration.
-
#new(*args) ⇒ Object
Delegate #new to the client class enabling faster client initialization e.g.
-
#new_from_env(*args) ⇒ Object
Delegate #new_from_env to the client class enabling faster client initialization e.g.
- #test? ⇒ Boolean
Constructor Details
#initialize(root_key, args = {}) ⇒ LedgerConfiguration
Returns a new instance of LedgerConfiguration.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ledger_sync/ledger_configuration.rb', line 25 def initialize(root_key, args = {}) @root_key = root_key @aliases = [] @root_path = args.fetch(:root_path, "ledger_sync/ledgers/#{root_key}") require client_path @base_module = args.fetch(:base_module, nil) @base_module ||= LedgerSync::Ledgers.const_get(LedgerSync::Util::StringHelpers.camelcase(root_key)) end |
Instance Attribute Details
#aliases ⇒ Object (readonly)
Returns the value of attribute aliases.
12 13 14 |
# File 'lib/ledger_sync/ledger_configuration.rb', line 12 def aliases @aliases end |
#base_module ⇒ Object (readonly)
Returns the value of attribute base_module.
12 13 14 |
# File 'lib/ledger_sync/ledger_configuration.rb', line 12 def base_module @base_module end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/ledger_sync/ledger_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/ledger_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.
12 13 14 |
# File 'lib/ledger_sync/ledger_configuration.rb', line 12 def root_key @root_key end |
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
12 13 14 |
# File 'lib/ledger_sync/ledger_configuration.rb', line 12 def root_path @root_path end |
#test ⇒ Object
Returns the value of attribute test.
8 9 10 |
# File 'lib/ledger_sync/ledger_configuration.rb', line 8 def test @test end |
Instance Method Details
#add_alias(new_alias) ⇒ Object
44 45 46 47 |
# File 'lib/ledger_sync/ledger_configuration.rb', line 44 def add_alias(new_alias) @aliases << new_alias LedgerSync.ledgers.add_alias(new_alias, self) end |
#client_class ⇒ Object
36 37 38 |
# File 'lib/ledger_sync/ledger_configuration.rb', line 36 def client_class @client_class ||= base_module::Client end |
#client_path ⇒ Object
40 41 42 |
# File 'lib/ledger_sync/ledger_configuration.rb', line 40 def client_path @client_path ||= File.join(root_path, 'client') end |
#new(*args) ⇒ Object
Delegate #new to the client class enabling faster client initialization e.g. LedgerSync.ledgers.test.new(…)
51 52 53 |
# File 'lib/ledger_sync/ledger_configuration.rb', line 51 def new(*args) client_class.new(*args) end |
#new_from_env(*args) ⇒ Object
Delegate #new_from_env to the client class enabling faster client initialization e.g. LedgerSync.ledgers.test.new_from_env(…)
57 58 59 |
# File 'lib/ledger_sync/ledger_configuration.rb', line 57 def new_from_env(*args) client_class.new_from_env(*args) end |
#test? ⇒ Boolean
61 62 63 |
# File 'lib/ledger_sync/ledger_configuration.rb', line 61 def test? test == true end |