class RediSearcher::Schema::Field
Constants
- OPTIONS_FLAGS
- OPTIONS_PARAMS
Attributes
name[R]
options[R]
type[R]
Public Class Methods
new(name, type, **options)
click to toggle source
# File lib/redi_searcher/schema/field.rb, line 16 def initialize(name, type, **options) default_options = type == :tag ? {separator: ','} : {} @name = name @type = type @options = default_options.deep_merge(options) end
Public Instance Methods
flags_for_type(type, **options)
click to toggle source
# File lib/redi_searcher/schema/field.rb, line 27 def flags_for_type(type, **options) self.class::OPTIONS_FLAGS[type].to_a.map do |key| key.to_s.upcase if options[key] end.compact end
params_for_type(type, **options)
click to toggle source
# File lib/redi_searcher/schema/field.rb, line 33 def params_for_type(type, **options) self.class::OPTIONS_PARAMS[type].to_a.map do |key| [key.to_s.upcase, *options[key]] unless options[key].nil? end.compact end
serialize()
click to toggle source
# File lib/redi_searcher/schema/field.rb, line 23 def serialize [name.to_s, type.to_s.upcase, flags_for_type(type, options), params_for_type(type, options), flags_for_type(:all, options)].flatten end