Class: VpsAdminOS::Converter::Devices::Device

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, major, minor, mode, opts = {}) ⇒ Device

Returns a new instance of Device

Parameters:

  • type (String)
  • major (String)
  • minor (String)
  • mode (String)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :name (String)

    device node name

  • :inherit (Boolean)


13
14
15
16
17
18
19
20
# File 'lib/vpsadminos-converter/devices.rb', line 13

def initialize(type, major, minor, mode, opts = {})
  @type = type
  @major = major
  @minor = minor
  @mode = mode
  @name = opts[:name]
  @inherit = opts.has_key?(:inherit) ? opts[:inherit] : true
end

Instance Attribute Details

#inheritObject

Returns the value of attribute inherit



4
5
6
# File 'lib/vpsadminos-converter/devices.rb', line 4

def inherit
  @inherit
end

#majorObject

Returns the value of attribute major



4
5
6
# File 'lib/vpsadminos-converter/devices.rb', line 4

def major
  @major
end

#minorObject

Returns the value of attribute minor



4
5
6
# File 'lib/vpsadminos-converter/devices.rb', line 4

def minor
  @minor
end

#modeObject

Returns the value of attribute mode



4
5
6
# File 'lib/vpsadminos-converter/devices.rb', line 4

def mode
  @mode
end

#nameObject

Returns the value of attribute name



4
5
6
# File 'lib/vpsadminos-converter/devices.rb', line 4

def name
  @name
end

#typeObject

Returns the value of attribute type



4
5
6
# File 'lib/vpsadminos-converter/devices.rb', line 4

def type
  @type
end

Instance Method Details

#dumpObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/vpsadminos-converter/devices.rb', line 22

def dump
  {
    'type' => type,
    'major' => major,
    'minor' => minor,
    'mode' => mode,
    'name' => name,
    'inherit' => inherit,
  }
end