class CypherBuilder::Field

Attributes

name[R]

Public Class Methods

new(prefix = nil, name) click to toggle source
# File lib/cypher_builder/field.rb, line 9
def initialize(prefix = nil, name)
  @prefix, @name = prefix, name
end

Public Instance Methods

aliased() click to toggle source
# File lib/cypher_builder/field.rb, line 25
def aliased
  sprintf('%s AS %s', prefixed_name, name)
end
as_cypher(payload:, context:) click to toggle source
# File lib/cypher_builder/field.rb, line 13
def as_cypher(payload:, context:)
  if context.ancestor?(Return) && !context.ancestor?(Alias)
    aliased
  else
    prefixed_name
  end
end
prefixed_name() click to toggle source
# File lib/cypher_builder/field.rb, line 21
def prefixed_name
  [@prefix, @name].compact.join('.')
end