Class: Vagrant::Actions::Collection
- Inherits:
-
Array
- Object
- Array
- Vagrant::Actions::Collection
- Defined in:
- lib/vagrant/actions/collection.rb
Instance Method Summary collapse
Instance Method Details
#dependencies! ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/vagrant/actions/collection.rb', line 4 def dependencies! each_with_index do |action, i| action.follows.each do |klass| unless self[0..i].klasses.include?(klass) raise DependencyNotSatisfiedException.new("#{action.class} action must follow #{klass}") end end action.precedes.each do |klass| unless self[i..length].klasses.include?(klass) raise DependencyNotSatisfiedException.new("#{action.class} action must precede #{klass}") end end end end |
#duplicates! ⇒ Object
24 25 26 |
# File 'lib/vagrant/actions/collection.rb', line 24 def duplicates! raise DuplicateActionException.new if duplicates? end |
#duplicates? ⇒ Boolean
20 21 22 |
# File 'lib/vagrant/actions/collection.rb', line 20 def duplicates? klasses.uniq.size != size end |
#klasses ⇒ Object
28 29 30 |
# File 'lib/vagrant/actions/collection.rb', line 28 def klasses map { |o| o.class } end |