class Tinet::Node::Interfase

Constants

TYPES

Attributes

args[R]
name[R]
node[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/node.rb, line 53
def initialize(name, type, args)
  @name = name
  @type = type.to_sym
  @args = args
  @node = nil
end
parse(interface_hash) click to toggle source

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

# File lib/tinet/node.rb, line 41
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

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