Sha256: 95e1f384ca410d88db01e331294cec6b72de85a41b4350d96812049acadbbfbe
Contents?: true
Size: 679 Bytes
Versions: 6
Compression:
Stored size: 679 Bytes
Contents
module Rake::Funnel::Support::MapperStyles class Default attr_reader :prefix, :value_separator def initialize @prefix = '/' @value_separator = ',' end def generate_from(model) model.map { |switch| switch.values.flatten.map { |value| [top_level(switch), nested(value)].reject(&:empty?) } }.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
Version data entries
6 entries across 6 versions & 1 rubygems