Class: FastSerializer::JsonModel::Array
- Inherits:
-
Relationship
- Object
- Node
- Attribute
- Relationship
- FastSerializer::JsonModel::Array
- Defined in:
- lib/fast_serializer/json_model/array.rb
Instance Attribute Summary
Attributes inherited from Relationship
Attributes inherited from Attribute
#cond, #cond_arity, #cond_method_name, #context, #injected, #key, #method, #method_arity, #method_name, #mixin, #opts
Instance Method Summary collapse
Methods inherited from Relationship
#exclude?, #include?, #include_relation?, #initialize
Methods inherited from Attribute
#initialize, #inject, #injectable?
Methods inherited from Node
Constructor Details
This class inherits a constructor from FastSerializer::JsonModel::Relationship
Instance Method Details
#included? ⇒ Boolean
20 21 22 |
# File 'lib/fast_serializer/json_model/array.rb', line 20 def included?(*) true end |
#serialize(resources, params, context) ⇒ Array
10 11 12 13 14 15 16 17 18 |
# File 'lib/fast_serializer/json_model/array.rb', line 10 def serialize(resources, params, context) return if resources.nil? if @serializer_klass @serializer_klass.new(resources, params).serializable_hash elsif @schema resources.map { |resource| @schema.serialize(resource, params, context) } end end |