Class: Havox::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/havox/classes/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, attributes) ⇒ Node

Returns a new instance of Node.



5
6
7
8
9
# File 'lib/havox/classes/node.rb', line 5

def initialize(name, attributes)
  @name = name
  @type = attributes[:type]&.to_sym
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



3
4
5
# File 'lib/havox/classes/node.rb', line 3

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/havox/classes/node.rb', line 3

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/havox/classes/node.rb', line 3

def type
  @type
end

Instance Method Details

#host?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/havox/classes/node.rb', line 11

def host?
  @type.eql?(:host)
end

#switch?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/havox/classes/node.rb', line 15

def switch?
  @type.eql?(:switch)
end