lib/maskable_attribute/formatting.rb in maskable_attribute-0.0.3 vs lib/maskable_attribute/formatting.rb in maskable_attribute-0.0.5
- old
+ new
@@ -56,15 +56,19 @@
def initialize(method=nil)
@method = method
end
def apply(input)
- if @method.is_a? Symbol
- input.send(@method)
- elsif @method.is_a? Proc
- @method.call input
- else
- input
+ begin
+ if @method.is_a? Symbol
+ input.send(@method)
+ elsif @method.is_a? Proc
+ @method.call input
+ else
+ input
+ end
+ rescue
+ nil
end
end
end
end
end