Sha256: bf5ddb847d28dd187592b4e019d896b7a2f59abc9f73b24795949eb3629422c2

Contents?: true

Size: 393 Bytes

Versions: 2

Compression:

Stored size: 393 Bytes

Contents

module CypherBuilder::Resolver
  def wrap(*values)
    values.map do |v|
      if v.respond_to?(:as_cypher)
        v
      elsif Symbol === v
        AsIs.new(v)
      else
        Literal.new(v)
      end
    end
  end

  def resolve(parts, format: '%s', separator: ' ', ** opts)
    Array(parts).map do |p|
      sprintf(format, p.as_cypher(** opts))
    end.join(separator).strip
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cypher_builder-0.0.5 lib/cypher_builder/infra/resolver.rb
cypher_builder-0.0.4 lib/cypher_builder/infra/resolver.rb