Class: VpsAdminOS::Converter::Vz6::ConfigItem::Device

Inherits:
Struct
  • Object
show all
Defined in:
lib/vpsadminos-converter/vz6/config_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#majorObject

Returns the value of attribute major

Returns:

  • (Object)

    the current value of major



5
6
7
# File 'lib/vpsadminos-converter/vz6/config_item.rb', line 5

def major
  @major
end

#minorObject

Returns the value of attribute minor

Returns:

  • (Object)

    the current value of minor



5
6
7
# File 'lib/vpsadminos-converter/vz6/config_item.rb', line 5

def minor
  @minor
end

#modeObject

Returns the value of attribute mode

Returns:

  • (Object)

    the current value of mode



5
6
7
# File 'lib/vpsadminos-converter/vz6/config_item.rb', line 5

def mode
  @mode
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



5
6
7
# File 'lib/vpsadminos-converter/vz6/config_item.rb', line 5

def type
  @type
end

Instance Method Details

#to_ct_deviceObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vpsadminos-converter/vz6/config_item.rb', line 10

def to_ct_device
  Devices::Device.new(
    case type
    when 'b'
      'block'
    when 'c'
      'char'
    else
      fail "unsupported device type '#{type}'"
    end,
    major,
    minor,
    # q is for quota management, not supported in vpsAdminOS
    mode == 'none' ? '' : mode.gsub('q', '')
  )
end

#to_sObject



6
7
8
# File 'lib/vpsadminos-converter/vz6/config_item.rb', line 6

def to_s
  "#{type}:#{major}:#{minor}:#{mode}"
end