class RediSearcher::Schema

Attributes

fields[R]

Public Class Methods

new(**fields) click to toggle source
# File lib/redi_searcher/schema.rb, line 5
def initialize(**fields)
  @fields = []
  build_fields_params(fields).each do |value|
    @fields << Field.new(*value)
  end
end

Public Instance Methods

serialize() click to toggle source
# File lib/redi_searcher/schema.rb, line 12
def serialize
  @fields.map(&:serialize)
end

Private Instance Methods

build_fields_params(**fields) click to toggle source
# File lib/redi_searcher/schema.rb, line 18
def build_fields_params(**fields)
  fields.map{ |key, value| [key, value.is_a?(Hash) ? value.to_a : value].flatten}
end