Class: JsonApiModel::ResultSet
- Inherits:
-
Object
- Object
- JsonApiModel::ResultSet
show all
- Defined in:
- lib/json_api_model/result_set.rb
Instance Method Summary
collapse
Constructor Details
#initialize(client_result_set, resource_class) ⇒ ResultSet
Returns a new instance of ResultSet.
3
4
5
|
# File 'lib/json_api_model/result_set.rb', line 3
def initialize( client_result_set, resource_class )
@set = client_result_set
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
21
22
23
|
# File 'lib/json_api_model/result_set.rb', line 21
def method_missing( m, *args, &block )
@set.send m, *args, &block
end
|
Instance Method Details
#as_json(opts = {}) ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'lib/json_api_model/result_set.rb', line 7
def as_json( opts = {} )
if block_given?
yield @set, meta
else
{ data: @set,
meta: meta
}
end
end
|
17
18
19
|
# File 'lib/json_api_model/result_set.rb', line 17
def meta
@set.meta.attributes
end
|