Class: Transflow::Publisher

Inherits:
Object
  • Object
show all
Includes:
Wisper::Publisher
Defined in:
lib/transflow/publisher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, op) ⇒ Publisher

Returns a new instance of Publisher.



11
12
13
14
# File 'lib/transflow/publisher.rb', line 11

def initialize(name, op)
  @name = name
  @op = op
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/transflow/publisher.rb', line 7

def name
  @name
end

#opObject (readonly)

Returns the value of attribute op.



9
10
11
# File 'lib/transflow/publisher.rb', line 9

def op
  @op
end

Instance Method Details

#call(*args) ⇒ Object Also known as: []



16
17
18
19
20
21
22
23
# File 'lib/transflow/publisher.rb', line 16

def call(*args)
  result = op.call(*args)
  broadcast(:"#{name}_success", result)
  result
rescue => err
  broadcast(:"#{name}_failure", *args, err)
  raise err
end