Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library barback.test.transformer.declare_asset; | |
| 6 | |
| 7 import 'dart:async'; | |
| 8 | |
| 9 import 'package:barback/barback.dart'; | |
| 10 import 'package:barback/src/utils.dart'; | |
| 11 | |
| 12 import 'mock.dart'; | |
| 13 | |
| 14 /// A transformer that declares some outputs and emits others | |
|
Bob Nystrom
2014/04/08 18:23:44
"."
nweiz
2014/04/08 23:42:33
Done.
| |
| 15 class DeclareAssetsTransformer extends MockTransformer { | |
| 16 final List<AssetId> declared; | |
|
Bob Nystrom
2014/04/08 18:23:44
Document these.
nweiz
2014/04/08 23:42:33
Done.
| |
| 17 final List<AssetId> emitted; | |
| 18 | |
| 19 DeclareAssetsTransformer(Iterable<String> declared, Iterable<String> emitted) | |
| 20 : this.declared = declared.map((id) => new AssetId.parse(id)).toList(), | |
| 21 this.emitted = emitted.map((id) => new AssetId.parse(id)).toList(); | |
| 22 | |
| 23 Future<bool> doIsPrimary(AssetId id) => new Future.value(true); | |
| 24 | |
| 25 Future doApply(Transform transform) { | |
| 26 return newFuture(() { | |
| 27 for (var id in emitted) { | |
| 28 transform.addOutput(new Asset.fromString(id, id.toString())); | |
| 29 } | |
| 30 }); | |
| 31 } | |
| 32 | |
| 33 Future declareOutputs(DeclaringTransform transform) { | |
| 34 return newFuture(() { | |
| 35 declared.forEach(transform.declareOutput); | |
| 36 }); | |
| 37 } | |
| 38 } | |
| OLD | NEW |