Class: Xing::Serializers::List
- Inherits:
-
Base
- Object
- ActiveModel::Serializer
- Base
- Xing::Serializers::List
show all
- Defined in:
- lib/xing/serializers/list.rb
Instance Method Summary
collapse
Methods inherited from Base
#as_json_with_wrap, #root, #routes
Instance Method Details
#as_json_without_wrap(options = {}) ⇒ Object
24
25
26
27
28
|
# File 'lib/xing/serializers/list.rb', line 24
def as_json_without_wrap(options={})
object.map do |item|
item_serializer_class.new(item, item_serializer_options).as_json
end
end
|
#item_serializer_class ⇒ Object
6
7
8
9
|
# File 'lib/xing/serializers/list.rb', line 6
def item_serializer_class
raise NotImplementedError,
"subclasses of Xing::Serializers::List must override item_serializer_class to refer to the per-item serializer"
end
|
#item_serializer_options ⇒ Object
11
12
13
|
# File 'lib/xing/serializers/list.rb', line 11
def item_serializer_options
{}
end
|
#links ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/xing/serializers/list.rb', line 30
def links
links = {
:self => self_link
}
links[:template] = template_link unless template_link.nil?
return links
end
|
#self_link ⇒ Object
19
20
21
22
|
# File 'lib/xing/serializers/list.rb', line 19
def self_link
raise NotImplementedError,
"subclasses of Xing::Serializers::List must override self_link to return their own path"
end
|
#template_link ⇒ Object
15
16
17
|
# File 'lib/xing/serializers/list.rb', line 15
def template_link
return nil
end
|