Class: ZeroRuby::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/zero_ruby/configuration.rb

Overview

Configuration class for ZeroRuby.

Examples:

ZeroRuby.configure do |config|
  config.lmid_store = :active_record
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



18
19
20
21
# File 'lib/zero_ruby/configuration.rb', line 18

def initialize
  @lmid_store = :active_record
  @supported_push_version = 1
end

Instance Attribute Details

#lmid_storeObject

LMID (Last Mutation ID) tracking settings The LMID store backend: :active_record or a custom LmidStore instance



13
14
15
# File 'lib/zero_ruby/configuration.rb', line 13

def lmid_store
  @lmid_store
end

#supported_push_versionObject

The push version supported by this configuration



16
17
18
# File 'lib/zero_ruby/configuration.rb', line 16

def supported_push_version
  @supported_push_version
end

Instance Method Details

#lmid_store_instanceLmidStore

Get the configured LMID store instance

Returns:



25
26
27
28
29
30
31
32
33
34
# File 'lib/zero_ruby/configuration.rb', line 25

def lmid_store_instance
  case @lmid_store
  when :active_record
    LmidStores::ActiveRecordStore.new
  when LmidStore
    @lmid_store
  else
    raise ArgumentError, "Unknown LMID store: #{@lmid_store.inspect}. Use :active_record or pass a custom LmidStore instance."
  end
end