Class: Underway::SawyerToJson
- Inherits:
-
Object
- Object
- Underway::SawyerToJson
- Defined in:
- lib/underway/sawyer_to_json.rb
Class Method Summary collapse
Class Method Details
.convert(object) ⇒ Object
6 7 8 |
# File 'lib/underway/sawyer_to_json.rb', line 6 def self.convert(object) JSON.generate(unwrap(object)) end |
.unwrap(object) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/underway/sawyer_to_json.rb', line 10 def self.unwrap(object) case object when Array then object.map { |o| unwrap(o) } when Sawyer::Resource then object.to_hash else object end end |