Class: Roby::UntilGenerator

Inherits:
EventGenerator
  • Object
show all
Defined in:
lib/roby/until_generator.rb

Overview

This event generator combines a source and a limit in a temporal pattern. The generator acts as a pass-through for the source, until the limit is itself emitted. It means that:

  • before the limit is emitted, the generator will emit each time its source emits
  • since the point where the limit is emitted, the generator does not emit anymore

See also EventGenerator#until

Instance Method Summary collapse

Constructor Details

#initialize(source = nil, limit = nil) ⇒ UntilGenerator

Creates a until generator for the given source and limit event generators



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/roby/until_generator.rb', line 17

def initialize(source = nil, limit = nil)
    super() do |context|
        forwarded_generators = each_parent_object(EventStructure::Forwarding).to_a
        forwarded_generators.each do |g|
            g.remove_forwarding self
        end
    end

    if source && limit
        source.forward_to(self)
        limit.signals(self)
    end
end