summaryrefslogtreecommitdiff
path: root/lib/humble/default_mapper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/humble/default_mapper.rb')
-rw-r--r--lib/humble/default_mapper.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/humble/default_mapper.rb b/lib/humble/default_mapper.rb
new file mode 100644
index 0000000..d92f68a
--- /dev/null
+++ b/lib/humble/default_mapper.rb
@@ -0,0 +1,16 @@
+class DefaultMapper
+ attr_reader :session, :table
+
+ def initialize(table, session)
+ @table = table
+ @session = session
+ end
+
+ def map_from(row)
+ table.type.new.tap do |entity|
+ table.each do |column|
+ column.apply(row, entity, session)
+ end
+ end
+ end
+end