lib/alba/attribute.rb in alba-0.1.0 vs lib/alba/attribute.rb in alba-0.2.0

- old
+ new

@@ -5,15 +5,15 @@ def initialize(name:, method:) @name = name @method = method end - def serialize(target) + def to_hash(target) case @method when Symbol, String target.public_send(@method) when Proc - @method.call(target) + @method.arity.zero? ? target.instance_exec(&@method) : @method.call(target) end end end end