Class: Serega::SeregaPlugins::Root::RootConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/serega/plugins/root/root.rb

Overview

Root config object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ SeregaPlugins::Root::RootConfig

Initializes RootConfig object

Parameters:

  • opts (Hash)

    root options

Options Hash (opts):

  • :one (Symbol, String, nil)

    root for single-object serialization

  • :many (Symbol, String, nil)

    root for many-objects serialization



155
156
157
# File 'lib/serega/plugins/root/root.rb', line 155

def initialize(opts)
  @opts = opts
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



144
145
146
# File 'lib/serega/plugins/root/root.rb', line 144

def opts
  @opts
end

Instance Method Details

#manySymbol, ...

Returns defined root for many-objects serialization.

Returns:

  • (Symbol, String, nil)

    defined root for many-objects serialization



165
166
167
# File 'lib/serega/plugins/root/root.rb', line 165

def many
  opts.fetch(:many)
end

#many=(value) ⇒ Symbol, ...

Set root for multiple-object serialization

Parameters:

  • value (Symbol, String, nil)

    root key

Returns:

  • (Symbol, String, nil)

    root key for multiple-object serialization



185
186
187
# File 'lib/serega/plugins/root/root.rb', line 185

def many=(value)
  opts[:many] = value
end

#oneSymbol, ...

Returns defined root for single-object serialization.

Returns:

  • (Symbol, String, nil)

    defined root for single-object serialization



160
161
162
# File 'lib/serega/plugins/root/root.rb', line 160

def one
  opts.fetch(:one)
end

#one=(value) ⇒ Symbol, ...

Set root for single-object serialization

Parameters:

  • value (Symbol, String, nil)

    root key

Returns:

  • (Symbol, String, nil)

    root key for single-object serialization



175
176
177
# File 'lib/serega/plugins/root/root.rb', line 175

def one=(value)
  opts[:one] = value
end