Module: Neon::Node
- Extended by:
- ArgumentHelpers
- Defined in:
- lib/neon/node.rb,
lib/neon/node/rest.rb
Defined Under Namespace
Classes: Rest
Class Method Summary collapse
-
.load(id, session = Neon::Session.current) ⇒ Node
Loads an existing node with the given id.
-
.new(attributes, labels, session) ⇒ Node
Creates a new Node in the database.
Methods included from ArgumentHelpers
Class Method Details
.load(id, session = Neon::Session.current) ⇒ Node
Loads an existing node with the given id
33 34 35 36 37 38 39 |
# File 'lib/neon/node.rb', line 33 def load(id, session = Neon::Session.current) begin session.load(id) rescue NoMethodError => e _raise_invalid_session_error(session, e) end end |
.new(attributes, labels, session) ⇒ Node
Creates a new Node in the database. All subsequent changes are immediately persisted.
17 18 19 20 21 22 23 24 25 |
# File 'lib/neon/node.rb', line 17 def new(attributes, *args) session = extract_session(args) labels = args.flatten begin session.create_node(attributes, labels) rescue NoMethodError => e _raise_invalid_session_error(session, e) end end |