class Node

Constants

NODE_TYPES

Attributes

label[RW]
name[RW]
rank[RW]
type[RW]

Public Class Methods

new(type, label, index, effect_flag) click to toggle source
# File lib/vispan/node.rb, line 7
def initialize(type, label, index, effect_flag)
  @name = transform_to_name(type, label, index, effect_flag)
  @type = NODE_TYPES.include?(type) ? type : ''
  @label = label
  @rank = 0
end

Public Instance Methods

transform_to_name(type, label, index, effect_flag) click to toggle source
# File lib/vispan/node.rb, line 14
def transform_to_name(type, label, index, effect_flag)
  label = 'node_' + SecureRandom.uuid if effect_flag
  label = label.gsub(/[-\s.]/, '') + index.to_s
  label.gsub(/[\/\'|\"|\*|\\]/, '_')
end