Class: ReeMapper::BuildMapperFactory

Inherits:
Object
  • Object
show all
Includes:
Ree::FnDSL
Defined in:
lib/ree_lib/packages/ree_mapper/package/ree_mapper/functions/build_mapper_factory.rb

Instance Method Summary collapse

Instance Method Details

#call(strategies:) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ree_lib/packages/ree_mapper/package/ree_mapper/functions/build_mapper_factory.rb', line 13

def call(strategies:)
  klass = Class.new(ReeMapper::MapperFactory)

  klass.instance_eval {
    @types = {}
    @wrappers = {}
    @strategies = strategies
  }

  klass.register_type(:bool, ReeMapper::Bool.new)
  klass.register_type(:date_time, ReeMapper::DateTime.new)
  klass.register_type(:time, ReeMapper::Time.new)
  klass.register_type(:date, ReeMapper::Date.new)
  klass.register_type(:float, ReeMapper::Float.new)
  klass.register_type(:integer, ReeMapper::Integer.new)
  klass.register_type(:string, ReeMapper::String.new)
  klass.register_type(:any, ReeMapper::Any.new)
  klass.register_type(:rational, ReeMapper::Rational.new)

  klass.register_wrapper(:array, ReeMapper::Array)

  klass
end