var attrs: Map[String, String] = new HashMap[String, String]
# Get the attributed value of 'prop' or null if 'prop' is undifened
+ #
# var img = new HTMLTag("img")
# img.attr("src", "./image.png").attr("alt", "image")
# assert img.get_attr("src") == "./image.png"
end
# Set a 'value' for 'key'
+ #
# var img = new HTMLTag("img")
# img.attr("src", "./image.png").attr("alt", "image")
# assert img.write_to_string == """<img src="./image.png" alt="image"/>"""
end
# Add a CSS class to the HTML tag
+ #
# var img = new HTMLTag("img")
# img.add_class("logo").add_class("fullpage")
# assert img.write_to_string == """<img class="logo fullpage"/>"""
var classes: Set[String] = new HashSet[String]
# Add multiple CSS classes
+ #
# var img = new HTMLTag("img")
# img.add_classes(["logo", "fullpage"])
# assert img.write_to_string == """<img class="logo fullpage"/>"""
end
# Set a CSS 'value' for 'prop'
+ #
# var img = new HTMLTag("img")
# img.css("border", "2px solid black").css("position", "absolute")
# assert img.write_to_string == """<img style="border: 2px solid black; position: absolute"/>"""
private var css_props: Map[String, String] = new HashMap[String, String]
# Get CSS value for 'prop'
+ #
# var img = new HTMLTag("img")
# img.css("border", "2px solid black").css("position", "absolute")
# assert img.get_css("border") == "2px solid black"
end
# Add a HTML 'child' to self
+ #
# var ul = new HTMLTag("ul")
# ul.add(new HTMLTag("li"))
# assert ul.write_to_string == "<ul><li></li></ul>"
var children: Set[HTMLTag] = new HashSet[HTMLTag]
# Clear all child and set the text of element
+ #
# var p = new HTMLTag("p")
# p.text("Hello World!")
# assert p.write_to_string == "<p>Hello World!</p>"
end
# Append text to element
+ #
# var p = new HTMLTag("p")
# p.append("Hello")
# p.add(new HTMLTag("br"))
#
# * `"nodes"`: An array with all nodes. Each node is an object with the
# following properties:
-# * `"labels"`: An array of all applied labels.
-# * `"properties"`: An object mapping each defined property to its value.
+# * `"labels"`: An array of all applied labels.
+# * `"properties"`: An object mapping each defined property to its value.
# * `"edges"`: An array with all relationships. Each relationship is an object
# with the following properties:
-# * `"type"`: The type (`String`) of the relationship.
-# * `"properties"`: An object mapping each defined property to its value.
-# * `"from"`: The local ID of the source node.
-# * `"to"`: The local ID of the destination node.
+# * `"type"`: The type (`String`) of the relationship.
+# * `"properties"`: An object mapping each defined property to its value.
+# * `"from"`: The local ID of the source node.
+# * `"to"`: The local ID of the destination node.
#
# ~~~nit
# import neo4j::graph::sequential_id
# a.labels.add "Foo"
# a["answer"] = 42
# a["Ultimate question of"] = new JsonArray.from(["life",
-# "the Universe", "and Everything."])
+# "the Universe", "and Everything."])
# graph.nodes.register a
# var b = graph.create_node
# b.labels.add "Foo"
# a.labels.add "Foo"
# a["answer"] = 42
# a["Ultimate question of"] = new JsonArray.from(["life",
- # "the Universe", "and Everything."])
+ # "the Universe", "and Everything."])
# graph.nodes.register a
# var b = graph.create_node
# b.labels.add "Foo"
# graph.edges.add new NeoEdge(a, "BAZ", b)
#
# graph = new NeoGraph.from_json(
- # new SequentialNodeCollection("node_id"), graph.to_json)
+ # new SequentialNodeCollection("node_id"), graph.to_json)
# assert 1 == graph.edges.length
# for edge in graph.edges do
# assert "BAZ" == edge.rel_type
#
# var node = new NeoNode.from_json("""
# {
- # "labels": ["foo", "Bar"],
- # "properties": {
- # "baz": 42
- # }
+ # "labels": ["foo", "Bar"],
+ # "properties": {
+ # "baz": 42
+ # }
# }
# """)
# assert ["foo", "Bar"] == node.labels
# Save the node in base
#
# var client = new Neo4jClient("http://localhost:7474")
- # #
+ #
# # Create a node
# var andres = new NeoNode
# andres["name"] = "Andres"
# From and to nodes will be created.
#
# var client = new Neo4jClient("http://localhost:7474")
- # #
+ #
# var andres = new NeoNode
# var kate = new NeoNode
# var edge = new NeoEdge(andres, "LOVES", kate)
# Retrieve all nodes with specified `lbl`
#
# var client = new Neo4jClient("http://localhost:7474")
- # #
+ #
# var andres = new NeoNode
# andres.labels.add_all(["Human", "Male"])
# client.save_node(andres)
# var kate = new NeoNode
# kate.labels.add_all(["Human", "Female"])
# client.save_node(kate)
- # #
+ #
# var nodes = client.nodes_with_label("Human")
# assert nodes.has(andres)
# assert nodes.has(kate)
# Retrieve nodes belonging to all the specified `labels`.
#
# var client = new Neo4jClient("http://localhost:7474")
- # #
+ #
# var andres = new NeoNode
# andres.labels.add_all(["Human", "Male"])
# client.save_node(andres)
# var kate = new NeoNode
# kate.labels.add_all(["Human", "Female"])
# client.save_node(kate)
- # #
+ #
# var nodes = client.nodes_with_labels(["Human", "Male"])
# assert nodes.has(andres)
# assert not nodes.has(kate)
return job
end
end
-