Class: Arkenstone::QueryList
- Inherits:
-
Array
- Object
- Array
- Arkenstone::QueryList
- Defined in:
- lib/arkenstone/enumerable/query_list.rb
Overview
QueryList extends Array to provide more customized options for Arkenstone documents.
Instance Method Summary collapse
-
#initialize(initial_value) ⇒ QueryList
constructor
If an array is provided, concatenate it onto the instance so that it becomes one long array.
-
#to_json(options = nil) ⇒ Object
Assumes that every element is an Arkenstone::Document.
Constructor Details
#initialize(initial_value) ⇒ QueryList
If an array is provided, concatenate it onto the instance so that it becomes one long array. Otherwise, push it on.
7 8 9 10 11 12 13 |
# File 'lib/arkenstone/enumerable/query_list.rb', line 7 def initialize(initial_value) if initial_value.instance_of?(Array) concat initial_value else push initial_value end end |
Instance Method Details
#to_json(options = nil) ⇒ Object
Assumes that every element is an Arkenstone::Document
16 17 18 |
# File 'lib/arkenstone/enumerable/query_list.rb', line 16 def to_json( = nil) map(&:attributes).to_json() end |