Class: SearchKit::Models::Documents
- Inherits:
-
Object
- Object
- SearchKit::Models::Documents
- Includes:
- Enumerable
- Defined in:
- lib/search_kit/models/documents.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#member_class ⇒ Object
readonly
Returns the value of attribute member_class.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(new_doc) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(contents = []) ⇒ Documents
constructor
A new instance of Documents.
Constructor Details
#initialize(contents = []) ⇒ Documents
12 13 14 15 |
# File 'lib/search_kit/models/documents.rb', line 12 def initialize(contents = []) @contents = contents @member_class = SearchKit::Models::Document end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
10 11 12 |
# File 'lib/search_kit/models/documents.rb', line 10 def contents @contents end |
#member_class ⇒ Object (readonly)
Returns the value of attribute member_class.
10 11 12 |
# File 'lib/search_kit/models/documents.rb', line 10 def member_class @member_class end |
Class Method Details
.[](*arguments) ⇒ Object
6 7 8 |
# File 'lib/search_kit/models/documents.rb', line 6 def self.[](*arguments) new(arguments) end |
Instance Method Details
#<<(new_doc) ⇒ Object
17 18 19 20 21 22 23 |
# 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) ⇒ Object
25 26 27 |
# File 'lib/search_kit/models/documents.rb', line 25 def each(&block) contents.each(&block) end |