Sha256: af9dbb8267cc3c579ec89ad4f7886587fa9f1c42e9b0d0448976ef10cf8b9e28
Contents?: true
Size: 871 Bytes
Versions: 17
Compression:
Stored size: 871 Bytes
Contents
require_relative 'mapping' require_relative 'dict_mappings_builder' module Immutabler module DSL class MappingsBuilder def initialize(mappings, &block) @mappings = mappings instance_eval(&block) end def map(origin_name, destination_name, options = {}) @mappings << Mapping.new(origin_name.to_s, destination_name.to_s, options) end def array(origin_name, destination_name, type) options = { type: type.to_s, array: true } @mappings << Mapping.new(origin_name.to_s, destination_name.to_s, options) end def dict(origin_name, destination_name, &block) mapping = Mapping.new(origin_name.to_s, destination_name.to_s, dict: true) DictMappingsBuilder.new(mapping.dict_mappings, &block) @mappings << mapping end end end end
Version data entries
17 entries across 17 versions & 1 rubygems