Skip to content

Instantly share code, notes, and snippets.

@kevinslin
Last active May 29, 2016 05:06
Show Gist options
  • Save kevinslin/288745a71706274a15e3d08edd5a1291 to your computer and use it in GitHub Desktop.
Save kevinslin/288745a71706274a15e3d08edd5a1291 to your computer and use it in GitHub Desktop.

Node syntax

=== Syntax 1

def build():
  nodes = {}
  node['a'] = Node(...)
  node['b'] = Node(...)
  ...

  edges = {
    a: [c, d]
    b: [e, f]
    c: [g, h]
    ...
  }

=== Syntax 2

Node(...) # node a
  .child(
    Node(...) # node b
      .child() # node e
      .child() # node f
  )
  .child(
    Node(...) # nodeC
  )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment