lib/useless/doc/serialization/dump.rb in useless-doc-0.5.0 vs lib/useless/doc/serialization/dump.rb in useless-doc-0.6.0
- old
+ new
@@ -46,10 +46,27 @@
hash_to_json \
'name' => api.name,
'url' => api.url,
'description' => api.description,
'timestamp' => api.timestamp ? api.timestamp.iso8601 : nil,
- 'resources' => api.resources.map { |resource| resource(resource) }
+ 'resources' => api.resources.map { |resource| resource(resource) },
+ 'concept' => stage(api.concept),
+ 'specification' => stage(api.specification),
+ 'implementation' => stage(api.implementation)
+ end
+ end
+
+ # Converts +Core::Stage+ instance to a JSON representation.
+ #
+ # @param [Core::Stage] stage the stage to be converted to JSON.
+ #
+ # @return [String] a JSON representation of the specified stage.
+ #
+ def self.stage(stage)
+ if stage
+ hash_to_json \
+ 'credit' => stage.credit,
+ 'progress' => stage.progress
end
end
# Converts a +Core::Resource+ instance to a JSON representation.
#