Module: Xolo::Core::JSONWrappers
- Included in:
- BaseClasses::ServerObject, BaseClasses::ServerObject
- Defined in:
- lib/xolo/core/json_wrappers.rb
Overview
constants and methods for consistent JSON processing on the server
Class Method Summary collapse
-
.extended(extender) ⇒ Object
when this module is extended.
-
.included(includer) ⇒ Object
when this module is included.
Instance Method Summary collapse
-
#parse_json(str) ⇒ Object
A wrapper for JSON.parse that always uses :symbolize_names and ensures UTF-8 encoding.
Class Method Details
.extended(extender) ⇒ Object
when this module is extended
19 20 21 |
# File 'lib/xolo/core/json_wrappers.rb', line 19 def self.extended(extender) Xolo.verbose_extend extender, self end |
.included(includer) ⇒ Object
when this module is included
24 25 26 |
# File 'lib/xolo/core/json_wrappers.rb', line 24 def self.included(includer) Xolo.verbose_include includer, self end |
Instance Method Details
#parse_json(str) ⇒ Object
A wrapper for JSON.parse that always uses :symbolize_names and ensures UTF-8 encoding
35 36 37 |
# File 'lib/xolo/core/json_wrappers.rb', line 35 def parse_json(str) JSON.parse str.force_encoding('UTF-8'), symbolize_names: true end |