Class: Granite::Action::Preconditions::PreconditionsCollection
- Inherits:
-
Object
- Object
- Granite::Action::Preconditions::PreconditionsCollection
- Includes:
- Enumerable
- Defined in:
- lib/granite/action/preconditions.rb
Overview
:nodoc:
Instance Method Summary collapse
- #+(other) ⇒ Object
- #execute!(context) ⇒ Object
-
#initialize(*preconditions) ⇒ PreconditionsCollection
constructor
A new instance of PreconditionsCollection.
Constructor Details
#initialize(*preconditions) ⇒ PreconditionsCollection
Returns a new instance of PreconditionsCollection.
21 22 23 |
# File 'lib/granite/action/preconditions.rb', line 21 def initialize(*preconditions) @preconditions = preconditions.flatten end |
Instance Method Details
#+(other) ⇒ Object
25 26 27 |
# File 'lib/granite/action/preconditions.rb', line 25 def +(other) self.class.new(*@preconditions, other) end |
#execute!(context) ⇒ Object
29 30 31 |
# File 'lib/granite/action/preconditions.rb', line 29 def execute!(context) @preconditions.each { |precondition| precondition.execute!(context) } end |