Class: Libsql::PositionalArgBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/libsql.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ PositionalArgBuilder

Returns a new instance of PositionalArgBuilder.



75
76
77
# File 'lib/libsql.rb', line 75

def initialize(*args)
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



73
74
75
# File 'lib/libsql.rb', line 73

def args
  @args
end

Instance Method Details

#buildObject



83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/libsql.rb', line 83

def build
  args.reduce([]) do |acc, value|
    type = case value
    in Integer
      "integer"
    in NilClass
      "null"
    else
      "text"
    end

    acc << { type:, value: }
  end
end

#empty?Boolean

Returns:

  • (Boolean)


79
# File 'lib/libsql.rb', line 79

def empty? = @args.empty?

#keyObject



81
# File 'lib/libsql.rb', line 81

def key = :args