Class: Granite::Action::Preconditions::PreconditionsCollection
- Inherits:
-
Object
- Object
- Granite::Action::Preconditions::PreconditionsCollection
- Defined in:
- lib/granite/action/preconditions.rb
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.
16 17 18 |
# File 'lib/granite/action/preconditions.rb', line 16 def initialize(*preconditions) @preconditions = preconditions.flatten end |
Instance Method Details
#+(other) ⇒ Object
20 21 22 |
# File 'lib/granite/action/preconditions.rb', line 20 def +(other) self.class.new(*@preconditions, other) end |
#execute!(context) ⇒ Object
24 25 26 |
# File 'lib/granite/action/preconditions.rb', line 24 def execute!(context) @preconditions.each { |precondition| precondition.execute!(context) } end |