Class: Simple::SQL::Helpers::RowConverter::StructConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/simple/sql/helpers/row_converter.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.for(attributes:) ⇒ Object



16
17
18
19
# File 'lib/simple/sql/helpers/row_converter.rb', line 16

def self.for(attributes:)
  @cache ||= {}
  @cache[attributes] ||= new(attributes)
end

Instance Method Details

#convert(hsh) ⇒ Object



29
30
31
32
# File 'lib/simple/sql/helpers/row_converter.rb', line 29

def convert(hsh)
  values = hsh.values_at(*@klass.members)
  @klass.new(*values)
end