Class: FluQ::DSL::Feed

Inherits:
Base
  • Object
show all
Defined in:
lib/fluq/dsl/feed.rb

Overview

Feed-level DSL configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ Feed

Returns a new instance of Feed.



5
6
7
8
9
10
# File 'lib/fluq/dsl/feed.rb', line 5

def initialize(name, &block)
  @name     = name
  @inputs   = []
  @handlers = []
  instance_eval(&block)
end

Instance Attribute Details

#handlersObject (readonly)

Returns the value of attribute handlers.



3
4
5
# File 'lib/fluq/dsl/feed.rb', line 3

def handlers
  @handlers
end

#inputsObject (readonly)

Returns the value of attribute inputs.



3
4
5
# File 'lib/fluq/dsl/feed.rb', line 3

def inputs
  @inputs
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/fluq/dsl/feed.rb', line 3

def name
  @name
end

Instance Method Details

#handler(*type, &block) ⇒ Object

Parameters:

  • handler (Array<Symbol>)

    type path, e.g. :log, :counter



19
20
21
22
# File 'lib/fluq/dsl/feed.rb', line 19

def handler(*type, &block)
  klass = constantize(:handler, *type)
  handlers.push [klass, FluQ::DSL::Options.new(&block).to_hash]
end

#input(*type, &block) ⇒ Object

Parameters:

  • input (Array<Symbol>)

    type path, e.g. :socket



13
14
15
16
# File 'lib/fluq/dsl/feed.rb', line 13

def input(*type, &block)
  klass = constantize(:input, *type)
  inputs.push [klass, FluQ::DSL::Options.new(&block).to_hash]
end