Class: Abroad::Serializers::Json::JsonSerializer
- Inherits:
-
Serializer
- Object
- Serializer
- Abroad::Serializers::Json::JsonSerializer
- Defined in:
- lib/abroad/serializers/json/json_serializer.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Serializer
Instance Attribute Summary collapse
-
#writer ⇒ Object
readonly
Returns the value of attribute writer.
Attributes inherited from Serializer
Instance Method Summary collapse
- #flush ⇒ Object
-
#initialize(stream, locale, options = {}) ⇒ JsonSerializer
constructor
A new instance of JsonSerializer.
- #write_raw(text) ⇒ Object
Methods inherited from Serializer
#close, #encoding, from_stream, open, #write_key_value
Constructor Details
#initialize(stream, locale, options = {}) ⇒ JsonSerializer
Returns a new instance of JsonSerializer.
10 11 12 13 |
# File 'lib/abroad/serializers/json/json_serializer.rb', line 10 def initialize(stream, locale, = {}) super @writer = JsonWriteStream.from_stream(stream, encoding) end |
Instance Attribute Details
#writer ⇒ Object (readonly)
Returns the value of attribute writer.
8 9 10 |
# File 'lib/abroad/serializers/json/json_serializer.rb', line 8 def writer @writer end |
Instance Method Details
#flush ⇒ Object
19 20 21 22 |
# File 'lib/abroad/serializers/json/json_serializer.rb', line 19 def flush writer.flush stream.flush end |
#write_raw(text) ⇒ Object
15 16 17 |
# File 'lib/abroad/serializers/json/json_serializer.rb', line 15 def write_raw(text) writer.stream.write(text) end |