Class: ROM::ModelBuilder::PORO

Inherits:
ROM::ModelBuilder show all
Defined in:
core/lib/rom/model_builder.rb

Overview

PORO model class builder

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from ROM::ModelBuilder

Instance Method Details

#define_class(attrs) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'core/lib/rom/model_builder.rb', line 88

def define_class(attrs)
  @klass = Class.new

  @klass.send(:attr_reader, *attrs)

  @klass.class_eval "    def initialize(params)\n      \#{attrs.map { |name| \"@\#{name} = params[:\#{name}]\" }.join(\"\\n\")}\n    end\n  RUBY\n\n  self\nend\n", __FILE__, __LINE__ + 1