Class: TwitterWithAutoPagination::Serializer
- Inherits:
-
Object
- Object
- TwitterWithAutoPagination::Serializer
show all
- Defined in:
- lib/twitter_with_auto_pagination/serializer.rb
Defined Under Namespace
Classes: Coder, JsonCoder, OjCoder
Class Method Summary
collapse
Class Method Details
.coder ⇒ Object
16
17
18
|
# File 'lib/twitter_with_auto_pagination/serializer.rb', line 16
def coder
@@coder ||= JsonCoder.new(JSON)
end
|
.coder=(coder) ⇒ Object
20
21
22
|
# File 'lib/twitter_with_auto_pagination/serializer.rb', line 20
def coder=(coder)
@@coder = Coder.instance(coder)
end
|
.decode(str, options = {}) ⇒ Object
10
11
12
13
14
|
# File 'lib/twitter_with_auto_pagination/serializer.rb', line 10
def decode(str, options = {})
instrument(options) do
str.kind_of?(String) ? coder.decode(str) : str
end
end
|
.encode(obj, options = {}) ⇒ Object
4
5
6
7
8
|
# File 'lib/twitter_with_auto_pagination/serializer.rb', line 4
def encode(obj, options = {})
instrument(options) do
(!!obj == obj) ? obj : coder.encode(obj)
end
end
|