Sha256: 2bd7e9777f3f0f751af547349176cc079741773647eec5c38b6c43a6e2c2ef31

Contents?: true

Size: 384 Bytes

Versions: 61

Compression:

Stored size: 384 Bytes

Contents

# private
module Simple::SQL::Helpers::Encoder
  extend self

  def encode_args(connection, args)
    args.map { |arg| encode_arg(connection, arg) }
  end

  def encode_arg(connection, arg)
    return arg unless arg.is_a?(Array)

    if arg.first.is_a?(String)
      "{#{arg.map { |a| "\"#{connection.escape(a)}\"" }.join(',')}}"
    else
      "{#{arg.join(',')}}"
    end
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
simple-sql-0.4.30 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.29 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.28 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.27 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.26 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.25 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.24 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.23 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.22 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.21 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.20 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.19 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.18 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.17 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.16 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.15 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.14 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.13 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.12 lib/simple/sql/helpers/encoder.rb
simple-sql-0.4.11 lib/simple/sql/helpers/encoder.rb