Class: Mumukit::Service::DocumentArray
- Inherits:
-
Object
- Object
- Mumukit::Service::DocumentArray
- Includes:
- Enumerable
- Defined in:
- lib/mumukit/service/document_array.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
Returns the value of attribute raw.
Instance Method Summary collapse
- #array_key ⇒ Object
- #as_json(options = {}) ⇒ Object
-
#initialize(raw, options = {}) ⇒ DocumentArray
constructor
A new instance of DocumentArray.
- #options ⇒ Object
Constructor Details
#initialize(raw, options = {}) ⇒ DocumentArray
Returns a new instance of DocumentArray.
8 9 10 11 |
# File 'lib/mumukit/service/document_array.rb', line 8 def initialize(raw, ={}) @raw = raw @default_key = [:default_key] end |
Instance Attribute Details
#raw ⇒ Object
Returns the value of attribute raw.
4 5 6 |
# File 'lib/mumukit/service/document_array.rb', line 4 def raw @raw end |
Instance Method Details
#array_key ⇒ Object
19 20 21 |
# File 'lib/mumukit/service/document_array.rb', line 19 def array_key @default_key || key end |
#as_json(options = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/mumukit/service/document_array.rb', line 13 def as_json(={}) {}.tap do |json| json[array_key] = raw.as_json(self..merge()) end end |
#options ⇒ Object
23 24 25 |
# File 'lib/mumukit/service/document_array.rb', line 23 def {} end |