Class: GraphViz::Parser::Node

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/graphviz/parser.rb

Instance Method Summary collapse

Instance Method Details

#eval(context) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/graphviz/parser.rb', line 102

def eval( context )
  node_name = name.text_value.gsub( /"/, "" )
  # puts "NODE NAME = #{node_name}"
  # puts "OPTIONS = "
  
  # Create node
  node = context.nodes[node_name] || context.graph.add_node( node_name )
    
  # Add global options
  context.options[:node].each do |k, v|
    node[k] = v
  end
  
  # Add custom options
  unless options.terminal?
    options.eval().each do |k, v|
      node[k] = v
    end
  end
  
  # Save node
  context.nodes[node_name] = node
end