Method: Agama::Graph#get_node

Defined in:
lib/agama/graph.rb

#get_node(node) ⇒ Object

Fetches the node requested



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/agama/graph.rb', line 71

def get_node(node)
  return nil unless node[:name]

  #Convert the node into a Key string and fetch the corresponding data
  key = Keyify.node(node)
  value = @db.n_get(key)

  if value
    new_node        = Marshal.load(value)
    new_node[:name] = node[:name]
    new_node[:type] = node[:type] || Config::DEFAULT_TYPE
    new_node
  end
end