class Tinet::Switch::Interfase

Constants

TYPES

Attributes

args[R]
name[R]
switch[R]
type[R]

Public Class Methods

new(name, type, args) click to toggle source

@param name [String] @param type [Symbol] @param args [String, nil]

# File lib/tinet/switch.rb, line 41
def initialize(name, type, args)
  @name = name
  @type = type.to_sym
  @args = args
  @switch = nil
end
parse(interface_hash) click to toggle source

@param interface_hash [Hash] @return [Tinet::Switch::Interfase]

# File lib/tinet/switch.rb, line 29
def self.parse(interface_hash)
  name, type, args = interface_hash['name'], interface_hash['type'], interface_hash['args']
  raise InvalidYAMLError, "Interfase name is missing" if name.nil? || name.empty?
  raise InvalidTypeError, "Unknown interface type: #{type}" unless TYPES.include?(type)
  self.new(name, type.to_sym, args)
end

Public Instance Methods

switch=(switch) click to toggle source
# File lib/tinet/switch.rb, line 48
def switch=(switch)
  @switch = switch
end