Sha256: fd751f822aadcdc502915074bbde90a4e734dc43df7a373438c0fdfdf282523a
Contents?: true
Size: 614 Bytes
Versions: 9
Compression:
Stored size: 614 Bytes
Contents
module Flare class IndexBuilder attr_reader :fields def initialize(&block) @fields = [] @attributes = {} self.instance_eval(&block) if block_given? end def index { :fields => @fields, :attributes => @attributes } end protected def field(*args) field, options = args.first, args.extract_options! @fields << { :source => field, :name => options[:as] || field, :boost => options[:boost] || nil } end def attribute(name, value) @attributes[name] = value end end end
Version data entries
9 entries across 9 versions & 1 rubygems