lib/hanami/model/mapping.rb in hanami-model-0.7.0 vs lib/hanami/model/mapping.rb in hanami-model-1.0.0.beta1
- old
+ new
@@ -1,17 +1,25 @@
-require 'transproc'
+require 'transproc/all'
module Hanami
module Model
# Mapping
#
# @since 0.1.0
class Mapping
+ extend Transproc::Registry
+
+ import Transproc::HashTransformations
+
def initialize(&blk)
@attributes = {}
@r_attributes = {}
instance_eval(&blk)
- @processor = @attributes.empty? ? ::Hash : Transproc(:rename_keys, @attributes)
+ @processor = @attributes.empty? ? ::Hash : t(:rename_keys, @attributes)
+ end
+
+ def t(name, *args)
+ self.class[name, *args]
end
def model(entity)
end