lib/arstotzka/wrapper.rb in arstotzka-1.5.0 vs lib/arstotzka/wrapper.rb in arstotzka-1.6.0

- old
+ new

@@ -73,15 +73,27 @@ # # Wraps an element with a class and perform typecasting # # @return [Object] def wrap_element(value) + value = apply_before(value) value = cast(value) return if value.nil? value = wrap_in_class(value) after(value) + end + + # @private + # + # Apply before option call + # + # @return [Object] + def apply_before(value) + return value unless options.before + + options.instance.send(options.before, value) end # @private # # Wraps each element of the array