Class: TwitterFriendly::Serializer
- Inherits:
-
Object
- Object
- TwitterFriendly::Serializer
show all
- Defined in:
- lib/twitter_friendly/serializer.rb
Defined Under Namespace
Modules: Instrumenter
Classes: Coder, JsonCoder, OjCoder
Class Method Summary
collapse
Class Method Details
.coder ⇒ Object
19
20
21
|
# File 'lib/twitter_friendly/serializer.rb', line 19
def coder
@@coder ||= Coder.instance
end
|
.coder=(coder) ⇒ Object
23
24
25
|
# File 'lib/twitter_friendly/serializer.rb', line 23
def coder=(coder)
@@coder = Coder.instance(coder)
end
|
.decode(str, args:) ⇒ Object
13
14
15
16
17
|
# File 'lib/twitter_friendly/serializer.rb', line 13
def decode(str, args:)
Instrumenter.perform_decode(args: args) do
str.kind_of?(String) ? coder.decode(str) : str
end
end
|
.encode(obj, args:) ⇒ Object
7
8
9
10
11
|
# File 'lib/twitter_friendly/serializer.rb', line 7
def encode(obj, args:)
Instrumenter.perform_encode(args: args) do
(!!obj == obj) ? obj : coder.encode(obj)
end
end
|