class SearchKit::Models::Documents

Attributes

contents[R]
member_class[R]

Public Class Methods

[](*arguments) click to toggle source
# File lib/search_kit/models/documents.rb, line 6
def self.[](*arguments)
  new(arguments)
end
new(contents = []) click to toggle source
# File lib/search_kit/models/documents.rb, line 12
def initialize(contents = [])
  @contents     = contents
  @member_class = SearchKit::Models::Document
end

Public Instance Methods

<<(new_doc) click to toggle source
# File lib/search_kit/models/documents.rb, line 17
def <<(new_doc)
  case new_doc
  when Hash         then contents << member_class.new(new_doc)
  when member_class then contents << new_doc
  else contents
  end
end
each(&block) click to toggle source
# File lib/search_kit/models/documents.rb, line 25
def each(&block)
  contents.each(&block)
end