Sha256: 8497876eba22345d2a925f4d10344fd76c0f2a98897c3163fdd040f4ff300c55
Contents?: true
Size: 653 Bytes
Versions: 4
Compression:
Stored size: 653 Bytes
Contents
# frozen_string_literal: true module Voucher class SegmentsParser def self.call(json) new(json).call end def initialize(json) @json = json end def call parse end private def parse content = segments_from_json SegmentsBuilder.call( election: content[:included]&.first, segments: content[:data] ) end def segments_from_json parsed_json = JSON.parse(@json) underscore_keys(parsed_json).with_indifferent_access end def underscore_keys(parsed_json) parsed_json.deep_transform_keys { |key| key.to_s.underscore } end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
voucher-0.3.0 | lib/voucher/segments_parser.rb |
voucher-0.2.1 | lib/voucher/segments_parser.rb |
voucher-0.1.1 | lib/voucher/segments_parser.rb |
voucher-0.1.0 | lib/voucher/segments_parser.rb |