Class: VpsAdminOS::Converter::CGParams

Inherits:
Object
  • Object
show all
Defined in:
lib/vpsadminos-converter/cg_params.rb

Instance Method Summary collapse

Constructor Details

#initializeCGParams

Returns a new instance of CGParams.



3
4
5
# File 'lib/vpsadminos-converter/cg_params.rb', line 3

def initialize
  @params = {}
end

Instance Method Details

#[](param) ⇒ Object



16
17
18
# File 'lib/vpsadminos-converter/cg_params.rb', line 16

def [](param)
  @params[param]
end

#dumpObject



20
21
22
23
24
25
26
27
28
# File 'lib/vpsadminos-converter/cg_params.rb', line 20

def dump
  @params.map do |param, v|
    {
      'subsystem' => param.split('.').first,
      'name' => param,
      'value' => v
    }
  end
end

#set(param, v) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/vpsadminos-converter/cg_params.rb', line 7

def set(param, v)
  @params[param] = if v.is_a?(Array)
                     v

                   else
                     [v]
                   end
end