lib/multi_sync/attributes/pathname.rb in multi_sync-0.0.3 vs lib/multi_sync/attributes/pathname.rb in multi_sync-0.0.4
- old
+ new
@@ -3,10 +3,23 @@
module MultiSync
module Attributes
class Pathname < ::Virtus::Attribute
def coerce(value)
- ::Pathname.new(value)
+ return ::Pathname.new(value) unless value.nil?
+ value
+ end
+
+ def value_coerced?(value)
+ value.is_a?(::Pathname)
+ end
+
+ def coercion_method
+ :to_s
+ end
+
+ def primitive
+ ::Pathname
end
end
end
end