Class: FluQ::Feed

Inherits:
Celluloid::SupervisionGroup
  • Object
show all
Defined in:
lib/fluq/feed.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ Feed

Constructor

Parameters:

  • name (String)

    feed name



11
12
13
14
15
# File 'lib/fluq/feed.rb', line 11

def initialize(name, &block)
  @name     = name.to_s
  @handlers = []
  super(&block)
end

Instance Attribute Details

#handlersObject (readonly)



7
8
9
# File 'lib/fluq/feed.rb', line 7

def handlers
  @handlers
end

#nameObject (readonly)



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

def name
  @name
end

Instance Method Details

#inputsArray<FluQ::Input::Base>

Returns inputs.

Returns:



18
19
20
# File 'lib/fluq/feed.rb', line 18

def inputs
  actors
end

#inspectString

Returns introspection.

Returns:

  • (String)

    introspection



37
38
39
# File 'lib/fluq/feed.rb', line 37

def inspect
  "#<#{self.class.name}(#{name}) inputs: #{inputs.size}, handlers: #{handlers.size}>"
end

#listen(klass, *args) ⇒ Object

Listens to an input

Parameters:

  • klass (Class<FluQ::Input::Base>)

    input class

  • args (multiple)

    initialization arguments



25
26
27
# File 'lib/fluq/feed.rb', line 25

def listen(klass, *args)
  supervise klass, name, handlers, *args
end

#register(klass, *args) ⇒ Object

Registers a handler

Parameters:

  • klass (Class<FluQ::Handler::Base>)

    handler class

  • args (multiple)

    initialization arguments



32
33
34
# File 'lib/fluq/feed.rb', line 32

def register(klass, *args)
  handlers.push [klass, *args]
end