Sha256: ac979a14c6554a161e6efec696ce2a872d5896687a7f435dacc8271acba237b3
Contents?: true
Size: 531 Bytes
Versions: 3
Compression:
Stored size: 531 Bytes
Contents
module CypherBuilder def Field(prefix = nil, name) Field.new(prefix, name) end class Field attr_reader :name def initialize(prefix = nil, name) @prefix, @name = prefix, name end def as_cypher(payload:, context:) if context.ancestor?(Return) && !context.ancestor?(Alias) aliased else prefixed_name end end def prefixed_name [@prefix, @name].compact.join('.') end def aliased sprintf('%s AS %s', prefixed_name, name) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cypher_builder-0.0.5 | lib/cypher_builder/field.rb |
cypher_builder-0.0.4 | lib/cypher_builder/field.rb |
cypher_builder-0.0.3 | lib/cypher_builder/field.rb |