2011-11-25 21:18:06 +00:00
|
|
|
module Jasmine::Headless
|
|
|
|
class UniqueAssetList < ::Array
|
|
|
|
def <<(asset)
|
2011-12-01 15:37:35 +00:00
|
|
|
raise InvalidUniqueAsset.new("Not an asset: #{asset.inspect}") if !asset.respond_to?(:logical_path)
|
2011-11-25 21:18:06 +00:00
|
|
|
|
2012-01-12 19:16:16 +00:00
|
|
|
super if !self.any? { |other| asset.pathname == other.pathname }
|
2011-11-25 21:18:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def flatten
|
|
|
|
self.collect(&:to_a).flatten
|
|
|
|
end
|
|
|
|
end
|
2011-12-01 15:37:35 +00:00
|
|
|
|
|
|
|
class InvalidUniqueAsset < StandardError ; end
|
2011-11-25 21:18:06 +00:00
|
|
|
end
|
|
|
|
|