Class: Ladybug::Config

Inherits:
Object
  • Object
show all
Extended by:
Loggability
Defined in:
lib/ladybug/config.rb

Overview

Kùzu system config options container class.

Constant Summary collapse

INSPECT_PARTS =

The detail fragments that make up the #inspect output, in the order they should appear.

[
	"buffer_pool_size:%d",
	"max_num_threads:%d",
	"enable_compression:%s",
	"read_only:%s",
	"max_db_size:%d",
	"auto_checkpoint:%s",
	"checkpoint_threshold:%d",
	"throw_on_wal_replay_failure:%s",
	"enable_checksums:%s",
	"enable_multi_writes:%s",
	"enable_default_hash_index:%s"
].freeze
INSPECT_FORMAT =

The printf pattern used for #inspect output

' ' + INSPECT_PARTS.join( ' ' )

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_options(source_options = nil, **options) ⇒ Object

Return a default Config object with the specified options overridden. If source_options is a Ladybug::Config, the returned object will be a clone of it with the options applied.



40
41
42
43
44
45
46
# File 'lib/ladybug/config.rb', line 40

def self::from_options( source_options=nil, **options )
	config = source_options.dup || new()

	config.set( **options )

	return config
end

Instance Method Details

#inspectObject

Return a human-readable representation of the object suitable for debugging.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/ladybug/config.rb', line 58

def inspect
	details = INSPECT_FORMAT % [
		self.buffer_pool_size,
		self.max_num_threads,
		self.enable_compression,
		self.read_only,
		self.max_db_size,
		self.auto_checkpoint,
		self.checkpoint_threshold,
		self.throw_on_wal_replay_failure,
		self.enable_checksums,
		self.enable_multi_writes,
		self.enable_default_hash_index
	]

	default = super
	return default.sub( />/, details + '>' )
end

#set(**options) ⇒ Object

Set one or more options.



50
51
52
53
54
# File 'lib/ladybug/config.rb', line 50

def set( **options )
	options.each do |opt, val|
		self.public_send( "#{opt}=", val )
	end
end