Sha256: 905ce94cea69c4d40b16e65da62313a1cb44b5ef88fc685fb40a0353e47ab53c

Contents?: true

Size: 469 Bytes

Versions: 3

Compression:

Stored size: 469 Bytes

Contents

module CypherBuilder
  def Node(prefix, labels: [])
    Node.new(prefix, labels: labels)
  end

  class Node < BasicObject
    def initialize(prefix, labels: [])
      @prefix, @labels = prefix, ::Kernel.Array(labels)
    end

    def as_cypher(_ = nil)
      [@prefix, *@labels].compact.join(':')
    end

    def respond_to_missing?(name, include_private = false)
      true
    end

    def method_missing(name, *_)
      ::Field.new(@prefix, name)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cypher_builder-0.0.3 lib/cypher_builder/node.rb
cypher_builder-0.0.2 lib/cypher_builder/node.rb
cypher_builder-0.0.1 lib/cypher_builder/node.rb