Sha256: afba7fd98fbf0f08feea4d103933c0343b1486b74263820da2ae9204221a642b
Contents?: true
Size: 976 Bytes
Versions: 3
Compression:
Stored size: 976 Bytes
Contents
# frozen_string_literal: true module Rake module Funnel module Support module ArgumentMapper module Styles class Default attr_reader :prefix, :value_separator def initialize @prefix = '/' @value_separator = ',' end def generate_from(model) model.map do |switch| switch.values.flatten.map do |value| [top_level(switch), nested(value)].reject(&:empty?) end end.flatten(2) end private def top_level(switch) [prefix, switch.switch] end def nested(value) res = [] res << value.key res << value_separator unless value.key.nil? || value.value.nil? res << value.value res.compact end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems