Sha256: 4591fbb7f1c8ee2b465cae176c541bebbd02a7cd441b49cb45f6835c413cde6a
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require 'rom/mapper_builder/model_dsl' require 'rom/mapper_builder/mapper_dsl' module ROM # @api private class MapperBuilder attr_reader :name, :root, :options, :prefix, :symbolize_keys, :dsl DEFAULT_PROCESSOR = :transproc def initialize(name, root, options = {}) @name = name @options = options @root = root @prefix = options[:prefix] @symbolize_keys = options[:symbolize_keys] attributes = if options[:inherit_header] root.header.map { |attr| [prefix ? :"#{prefix}_#{attr}" : attr] } else [] end @dsl = MapperDSL.new(attributes, options) @processor = DEFAULT_PROCESSOR end def processor(identifier = nil) if identifier @processor = identifier else @processor end end def call Mapper.build(dsl.header, processor) end private def method_missing(name, *args, &block) if dsl.respond_to?(name) dsl.public_send(name, *args, &block) else super end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rom-0.5.0 | lib/rom/mapper_builder.rb |