Sha256: bc3ce3909a58bf51eee69aa111565ad932c5e3f651a9a9010ca07e69fa38b427
Contents?: true
Size: 1.07 KB
Versions: 11
Compression:
Stored size: 1.07 KB
Contents
module GenesisRuby module Utils module Formatters # Object Formatter Contract # ObjectFormatter iterate over each formatter with the given structure class Base # The Response keys that the formatter will be applied to def formatting_keys [] end # The keys required for formatting the specific response key def required_keys [] end # Format the given Response Key value def format_key(*_args) raise NotImplementedError, 'Format method is not implemented' end # Collect required key's values requires for the Response Object formatting # Ex. Amount to Major requires Currency def collect_required_key_values(response_object) required_key_values = [] required_keys.each do |required_key| next unless response_object.include?(required_key.to_sym) required_key_values.push response_object[required_key.to_sym] end required_key_values end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems