Sha256: 8f46b69a12256bcacc163f2fadd1911db1e62037975bd3fccacf8012b44fa23a
Contents?: true
Size: 597 Bytes
Versions: 1
Compression:
Stored size: 597 Bytes
Contents
require 'rom/model_builder' module ROM class MapperBuilder module ModelDSL attr_reader :attributes, :builder, :klass DEFAULT_TYPE = :poro def model(options = nil) if options.is_a?(Class) @klass = options elsif options type = options.fetch(:type) { DEFAULT_TYPE } @builder = ModelBuilder[type].new(options) end build_class unless options end private def build_class return klass if klass return builder.call(attributes.map(&:first)) if builder end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rom-0.5.0 | lib/rom/mapper_builder/model_dsl.rb |