Class: ROM::ModelBuilder::PORO
- Inherits:
-
ROM::ModelBuilder
- Object
- ROM::ModelBuilder
- ROM::ModelBuilder::PORO
- Defined in:
- core/lib/rom/model_builder.rb
Overview
PORO model class builder
Instance Method Summary collapse
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 <<-RUBY, __FILE__, __LINE__ + 1 def initialize(params) #{attrs.map { |name| "@#{name} = params[:#{name}]" }.join("\n")} end RUBY self end |