lib/trackman/assets/asset.rb in trackman-0.6.9 vs lib/trackman/assets/asset.rb in trackman-0.6.10

- old
+ new

@@ -6,26 +6,28 @@ include Comparable def initialize attributes = {} @assets = [] - self.path = attributes[:path] self.virtual_path = attributes[:virtual_path] end attr_accessor :virtual_path attr_reader :path, :assets - def to_remote - RemoteAsset.create(:path => @path, :virtual_path => self.virtual_path) + def to_remote(id = nil) + RemoteAsset.create(:path => @path, :virtual_path => self.virtual_path, :id => id) end def ==(other) return false if other.nil? other_path = other.path.is_a?(Pathname) ? other.path : Pathname.new(other.path) - other_path.to_s == path.to_s || path.cleanpath == other_path.cleanpath + path_equal = other_path.to_s == path.to_s || path.cleanpath == other_path.cleanpath + vp_equal = virtual_path.to_s == other.virtual_path.to_s + + path_equal && vp_equal end def <=>(another) result = 0 @@ -48,10 +50,10 @@ def is_child_of(parent) parent.assets.include? self end def to_s - "<#{self.class}:\npath=#{path}\nfile_hash=#{file_hash}>" + "\n<#{self.class}>:\npath='#{path}'\nfile_hash='#{file_hash}'\nvirtual_path='#{virtual_path}'" end def self.all return [] unless maintenance_path.exist? \ No newline at end of file