Class: Pinecone::Vector::Query
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Pinecone::Vector::Query
- Defined in:
- lib/pinecone/vector/query.rb
Defined Under Namespace
Classes: QueryContract
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.new(input) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/pinecone/vector/query.rb', line 44 def self.new(input) validation = QueryContract.new.call(input) raise ArgumentError, validation.errors.to_h.inspect unless validation.success? super end |
Instance Method Details
#to_json(*_args) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/pinecone/vector/query.rb', line 51 def to_json(*_args) to_h.transform_keys do |key| key.to_s.split("_").map.with_index do |word, index| index.zero? ? word : word.capitalize end.join.to_sym end.to_json end |