Class: YeSQL::Bindings::Extractor

Inherits:
Object
  • Object
show all
Defined in:
lib/yesql/bindings/extractor.rb

Instance Method Summary collapse

Constructor Details

#initialize(bindings: {}) ⇒ Extractor

Returns a new instance of Extractor.



8
9
10
11
# File 'lib/yesql/bindings/extractor.rb', line 8

def initialize(bindings: {})
  @bindings = bindings
  @indexed_bindings = bindings.to_a
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
# File 'lib/yesql/bindings/extractor.rb', line 13

def call
  bindings
    .each_with_object({})
    .with_index(1) do |((key, value), hash), index|
      hash[key] = binding_extracts(hash, indexed_bindings, index, key, value)
    end
end