lib/multi_sync/target.rb in multi_sync-0.0.1 vs lib/multi_sync/target.rb in multi_sync-0.0.2

- old
+ new

@@ -1,34 +1,23 @@ require 'fog' require 'lazily' require 'virtus' require 'pathname' require 'celluloid' +require 'multi_sync/attributes/pathname' require 'multi_sync/mixins/log_helper' module MultiSync class Target - include Virtus include Celluloid + include Virtus.model include MultiSync::Mixins::LogHelper - - attribute :connection - attribute :target_dir, Pathname - attribute :destination_dir, Pathname + + attribute :target_dir, MultiSync::Attributes::Pathname, default: Pathname.new('') + attribute :destination_dir, MultiSync::Attributes::Pathname, default: Pathname.new('') attribute :credentials, Hash, default: :default_credentials - # Initialize a new Target object - # - # @param options [Hash] - def initialize(options = {}) - fail(ArgumentError, 'target_dir must be present') unless options[:target_dir] - self.target_dir = Pathname.new(options.fetch(:target_dir, '')) - self.destination_dir = Pathname.new(options.fetch(:destination_dir, '')) - credentials.merge!(options.fetch(:credentials, {})) - end - def default_credentials - # deep clone just in case Marshal.load(Marshal.dump(MultiSync.credentials)) end end end