Class: Dicey::OutputFormatters::HashFormatter Abstract
- Inherits:
-
Object
- Object
- Dicey::OutputFormatters::HashFormatter
- Defined in:
- lib/dicey/output_formatters/hash_formatter.rb
Overview
This class is abstract.
Base formatter for outputting in formats which can be converted from a Hash directly. Can add an optional description into the result.
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#call(hash, description = nil) ⇒ String
12 13 14 15 16 17 18 19 |
# File 'lib/dicey/output_formatters/hash_formatter.rb', line 12 def call(hash, description = nil) hash = hash.transform_keys { to_primitive(_1) } hash.transform_values! { to_primitive(_1) } output = {} output["description"] = description if description output["results"] = hash output.public_send(self.class::METHOD) end |