Sha256: 9c4a0dfac0fe114097b6f9dfed0964a5b3b5fe2aff941a536c4dd6965aa8a931
Contents?: true
Size: 864 Bytes
Versions: 2
Compression:
Stored size: 864 Bytes
Contents
# Root-level DSL configuration class FluQ::DSL::Root < FluQ::DSL::Base attr_reader :path, :feeds # @param [String] DSL script file path def initialize(path) @path = Pathname.new(path) @feeds = [] instance_eval @path.read end # @param [String] feed name, e.g. "my_events" def feed(name, &block) feeds.push FluQ::DSL::Feed.new(name, &block) end # @param [String] relative relative path def import(relative) instance_eval path.dirname.join(relative).read end # Applies the configuration. # Registers components of each feed. Handlers first, then inputs. # @param [FluQ::Runner] runner def apply(runner) feeds.each do |conf| runner.feed conf.name do |feed| conf.handlers.each {|k, *a| feed.register(k, *a) } conf.inputs.each {|k, *a| feed.listen(k, *a) } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fluq-0.8.1 | lib/fluq/dsl/root.rb |
fluq-0.8.0 | lib/fluq/dsl/root.rb |