Class: ROM::Firebase::StructCompiler

Inherits:
StructCompiler
  • Object
show all
Defined in:
lib/rom/firebase/struct_compiler.rb

Instance Method Summary collapse

Instance Method Details

#build_class(name, parent, ns, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
10
11
12
13
14
# File 'lib/rom/firebase/struct_compiler.rb', line 7

def build_class(name, parent, ns, &block)
  Dry::Core::ClassBuilder.
    new(name: class_name(name), parent: parent, namespace: ns).
    call do |struct|
      struct.transform_types { |type| type.optional? ? type.required(false) : type }
      block.call(struct)
    end
end