Module: Scripper::Sequel::ModelStripper
- Defined in:
- lib/scripper/sequel/model_stripper.rb
Class Method Summary collapse
Class Method Details
.strip(object, with_associations: nil, with_attributes: nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/scripper/sequel/model_stripper.rb', line 7 def strip(object, with_associations: nil, with_attributes: nil) association_fields = build_association_fields(object, with_associations) attribute_fields = build_attribute_fields(object, with_attributes) attrs = { **convert_values(object.values), **association_fields, **attribute_fields, } struct_klass = Struct.new(*attrs.keys) struct_klass.new(*attrs.values) end |